History

Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO updates from Greg KH: "Here is the "big" staging and IIO driver update for 4.15-rc1. Lots and lots of little changes, almost all minor code cleanups as the Outreachy application process happened during this development cycle. Also happened was a lot of IIO driver activity, and the typec USB code moving out of staging to drivers/usb (same commits are in the USB tree on a persistent branch to not cause merge issues.) Overall, it's a wash, I think we added a few hundred more lines than removed, but really only a few thousand were modified at all. All of these have been in linux-next for a while. There might be a merge issue with Al's vfs tree in the pi433 driver (take his changes, they are always better), and the media tree with some of the odd atomisp cleanups (take the media tree's version)" * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits) staging: lustre: add SPDX identifiers to all lustre files staging: greybus: Remove redundant license text staging: greybus: add SPDX identifiers to all greybus driver files staging: ccree: simplify ioread/iowrite staging: ccree: simplify registers access staging: ccree: simplify error handling logic staging: ccree: remove dead code staging: ccree: handle limiting of DMA masks staging: ccree: copy IV to DMAable memory staging: fbtft: remove redundant initialization of buf staging: sm750fb: Fix parameter mistake in poke32 staging: wilc1000: Fix bssid buffer offset in Txq staging: fbtft: fb_ssd1331: fix mirrored display staging: android: Fix checkpatch.pl error staging: greybus: loopback: convert loopback to use generic async operations staging: greybus: operation: add private data with get/set accessors staging: greybus: loopback: Fix iteration count on async path staging: greybus: loopback: Hold per-connection mutex across operations staging: greybus/loopback: use ktime_get() for time intervals staging: fsl-dpaa2/eth: Extra headroom in RX buffers ...

Linus Torvalds committed 9 years ago

Commit 449fcf32 parents 3c07399 c14dd9d1008 files · +8567 −8386Browse files

Unified · Split

1008 files
  1. Documentation/ABI/testing/sysfs-bus-iio +4 −3
  2. Documentation/ABI/testing/sysfs-bus-iio-cros-ec +10 −0
  3. Documentation/devicetree/bindings/iio/adc/mcp320x.txt +14 −0
  4. Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt +1 −0
  5. Documentation/devicetree/bindings/iio/dac/ds4424.txt +20 −0
  6. Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt +34 −0
  7. Documentation/devicetree/bindings/iio/health/max30100.txt +2 −2
  8. Documentation/devicetree/bindings/iio/health/max30102.txt +1 −1
  9. Documentation/devicetree/bindings/iio/st-sensors.txt +4 −0
  10. arch/arm/configs/pxa_defconfig +2 −1
  11. arch/arm/configs/raumfeld_defconfig +2 −1
  12. drivers/iio/accel/Kconfig +13 −2
  13. drivers/iio/accel/Makefile +2 −0
  14. drivers/iio/accel/adxl345_core.c +0 −1
  15. drivers/iio/accel/bma180.c +0 −2
  16. drivers/iio/accel/bma220_spi.c +0 −1
  17. drivers/iio/accel/bmc150-accel-core.c +0 −3
  18. drivers/iio/accel/cros_ec_accel_legacy.c +423 −0
  19. drivers/iio/accel/da280.c +0 −1
  20. drivers/iio/accel/da311.c +0 −1
  21. drivers/iio/accel/dmard06.c +0 −1
  22. drivers/iio/accel/dmard09.c +0 −1
  23. drivers/iio/accel/dmard10.c +0 −1
  24. drivers/iio/accel/hid-sensor-accel-3d.c +0 −1
  25. drivers/iio/accel/kxcjk-1013.c +227 −129
  26. drivers/iio/accel/kxsd9.c +0 −1
  27. drivers/iio/accel/mc3230.c +0 −1
  28. drivers/iio/accel/mma7455_core.c +0 −1
  29. drivers/iio/accel/mma7660.c +0 −1
  30. drivers/iio/accel/mma8452.c +215 −168
  31. drivers/iio/accel/mma9551.c +0 −1
  32. drivers/iio/accel/mma9553.c +0 −1
  33. drivers/iio/accel/mxc4005.c +0 −2
  34. drivers/iio/accel/mxc6255.c +0 −1
  35. drivers/iio/accel/sca3000.c +0 −1
  36. drivers/iio/accel/st_accel.h +4 −0
  37. drivers/iio/accel/st_accel_core.c +213 −35
  38. drivers/iio/accel/st_accel_i2c.c +5 −0
  39. drivers/iio/accel/st_accel_spi.c +10 −0
  40. drivers/iio/accel/stk8312.c +0 −2
  41. drivers/iio/accel/stk8ba50.c +0 −2
  42. drivers/iio/adc/Kconfig +4 −3
  43. drivers/iio/adc/ad7266.c +0 −1
  44. drivers/iio/adc/ad7291.c +0 −1
  45. drivers/iio/adc/ad7298.c +0 −1
  46. drivers/iio/adc/ad7476.c +0 −1
  47. drivers/iio/adc/ad7766.c +0 −2
  48. drivers/iio/adc/ad7791.c +0 −2
  49. drivers/iio/adc/ad7793.c +0 −2
  50. drivers/iio/adc/ad7887.c +0 −1
  51. drivers/iio/adc/ad7923.c +0 −1
  52. drivers/iio/adc/ad799x.c +0 −3
  53. drivers/iio/adc/ad_sigma_delta.c +0 −1
  54. drivers/iio/adc/aspeed_adc.c +0 −1
  55. drivers/iio/adc/at91-sama5d2_adc.c +0 −2
  56. drivers/iio/adc/at91_adc.c +0 −2
  57. drivers/iio/adc/axp20x_adc.c +0 −2
  58. drivers/iio/adc/axp288_adc.c +0 −1
  59. drivers/iio/adc/bcm_iproc_adc.c +0 −1
  60. drivers/iio/adc/berlin2-adc.c +0 −1
  61. drivers/iio/adc/cc10001_adc.c +0 −1
  62. drivers/iio/adc/cpcap-adc.c +0 −1
  63. drivers/iio/adc/da9150-gpadc.c +0 −1
  64. drivers/iio/adc/dln2-adc.c +0 −6
  65. drivers/iio/adc/envelope-detector.c +0 −1
  66. drivers/iio/adc/ep93xx_adc.c +0 −1
  67. drivers/iio/adc/exynos_adc.c +0 −1
  68. drivers/iio/adc/hi8435.c +0 −1
  69. drivers/iio/adc/hx711.c +0 −1
  70. drivers/iio/adc/imx7d_adc.c +0 −1
  71. drivers/iio/adc/ina2xx-adc.c +9 −11
  72. drivers/iio/adc/lp8788_adc.c +0 −1
  73. drivers/iio/adc/lpc18xx_adc.c +0 −1
  74. drivers/iio/adc/lpc32xx_adc.c +0 −1
  75. drivers/iio/adc/ltc2471.c +0 −1
  76. drivers/iio/adc/ltc2485.c +0 −1
  77. drivers/iio/adc/ltc2497.c +0 −1
  78. drivers/iio/adc/max1027.c +0 −2
  79. drivers/iio/adc/max11100.c +0 −1
  80. drivers/iio/adc/max1118.c +0 −1
  81. drivers/iio/adc/max1363.c +0 −2
  82. drivers/iio/adc/max9611.c +0 −2
  83. drivers/iio/adc/mcp320x.c +156 −79
  84. drivers/iio/adc/mcp3422.c +0 −1
  85. drivers/iio/adc/men_z188_adc.c +0 −1
  86. drivers/iio/adc/meson_saradc.c +0 −1
  87. drivers/iio/adc/mt6577_auxadc.c +1 −1
  88. drivers/iio/adc/mxs-lradc-adc.c +0 −2
  89. drivers/iio/adc/nau7802.c +0 −1
  90. drivers/iio/adc/palmas_gpadc.c +0 −1
  91. drivers/iio/adc/qcom-pm8xxx-xoadc.c +0 −1
  92. drivers/iio/adc/qcom-spmi-iadc.c +0 −1
  93. drivers/iio/adc/qcom-spmi-vadc.c +0 −1
  94. drivers/iio/adc/rcar-gyroadc.c +3 −5
  95. drivers/iio/adc/rockchip_saradc.c +0 −1
  96. drivers/iio/adc/spear_adc.c +0 −1
  97. drivers/iio/adc/stm32-adc-core.c +13 −0
  98. drivers/iio/adc/stm32-adc.c +1 −1
  99. drivers/iio/adc/stx104.c +0 −1
  100. drivers/iio/adc/sun4i-gpadc-iio.c +21 −24
  101. drivers/iio/adc/ti-adc081c.c +0 −1
  102. drivers/iio/adc/ti-adc0832.c +0 −1
  103. drivers/iio/adc/ti-adc084s021.c +0 −1
  104. drivers/iio/adc/ti-adc108s102.c +0 −1
  105. drivers/iio/adc/ti-adc12138.c +1 −2
  106. drivers/iio/adc/ti-adc128s052.c +0 −1
  107. drivers/iio/adc/ti-adc161s626.c +0 −1
  108. drivers/iio/adc/ti-ads1015.c +10 −12
  109. drivers/iio/adc/ti-ads7950.c +0 −1
  110. drivers/iio/adc/ti-ads8688.c +0 −2
  111. drivers/iio/adc/ti-tlc4541.c +0 −1
  112. drivers/iio/adc/ti_am335x_adc.c +0 −1
  113. drivers/iio/adc/twl4030-madc.c +0 −1
  114. drivers/iio/adc/twl6030-gpadc.c +0 −1
  115. drivers/iio/adc/vf610_adc.c +0 −1
  116. drivers/iio/adc/viperboard_adc.c +0 −1
  117. drivers/iio/adc/xilinx-xadc-core.c +0 −2
  118. drivers/iio/amplifiers/ad8366.c +0 −1
  119. drivers/iio/chemical/ams-iaq-core.c +0 −1
  120. drivers/iio/chemical/atlas-ph-sensor.c +0 −2
  121. drivers/iio/chemical/ccs811.c +85 −2
  122. drivers/iio/chemical/vz89x.c +0 −1
  123. drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +0 −1
  124. drivers/iio/common/hid-sensors/hid-sensor-trigger.c +9 −4
  125. drivers/iio/common/st_sensors/st_sensors_core.c +40 −19
  126. drivers/iio/common/st_sensors/st_sensors_trigger.c +4 −12
  127. drivers/iio/counter/104-quad-8.c +0 −1
  128. drivers/iio/counter/stm32-lptimer-cnt.c +0 −1
  129. drivers/iio/dac/Kconfig +21 −1
  130. drivers/iio/dac/Makefile +2 −0
  131. drivers/iio/dac/ad5064.c +0 −1
  132. drivers/iio/dac/ad5360.c +0 −1
  133. drivers/iio/dac/ad5380.c +0 −1
  134. drivers/iio/dac/ad5421.c +0 −1
  135. drivers/iio/dac/ad5446.c +13 −1
  136. drivers/iio/dac/ad5449.c +0 −1
  137. drivers/iio/dac/ad5504.c +0 −1
  138. drivers/iio/dac/ad5592r-base.c +0 −1
  139. drivers/iio/dac/ad5624r_spi.c +0 −1
  140. drivers/iio/dac/ad5686.c +0 −1
  141. drivers/iio/dac/ad5755.c +0 −1
  142. drivers/iio/dac/ad5761.c +0 −1
  143. drivers/iio/dac/ad5764.c +0 −1
  144. drivers/iio/dac/ad5791.c +0 −1
  145. drivers/iio/dac/ad7303.c +0 −1
  146. drivers/iio/dac/ad8801.c +0 −1
  147. drivers/iio/dac/cio-dac.c +0 −1
  148. drivers/iio/dac/dpot-dac.c +0 −1
  149. drivers/iio/dac/ds4424.c +341 −0
  150. drivers/iio/dac/lpc18xx_dac.c +0 −1
  151. drivers/iio/dac/ltc2632.c +0 −1
  152. drivers/iio/dac/m62332.c +0 −1
  153. drivers/iio/dac/max517.c +0 −1
  154. drivers/iio/dac/max5821.c +0 −1
  155. drivers/iio/dac/mcp4725.c +0 −1
  156. drivers/iio/dac/mcp4922.c +0 −1
  157. drivers/iio/dac/stm32-dac.c +0 −1
  158. drivers/iio/dac/ti-dac082s085.c +368 −0
  159. drivers/iio/dac/vf610_dac.c +0 −1
  160. drivers/iio/dummy/Kconfig +1 −1
  161. drivers/iio/dummy/iio_dummy_evgen.c +19 −70
  162. drivers/iio/dummy/iio_simple_dummy.c +0 −1
  163. drivers/iio/frequency/ad9523.c +0 −1
  164. drivers/iio/frequency/adf4350.c +0 −1
  165. drivers/iio/gyro/adis16080.c +0 −1
  166. drivers/iio/gyro/adis16130.c +0 −1
  167. drivers/iio/gyro/adis16136.c +0 −1
  168. drivers/iio/gyro/adis16260.c +0 −1
  169. drivers/iio/gyro/adxrs450.c +0 −1
  170. drivers/iio/gyro/bmg160_core.c +0 −2
  171. drivers/iio/gyro/hid-sensor-gyro-3d.c +0 −1
  172. drivers/iio/gyro/itg3200_buffer.c +0 −1
  173. drivers/iio/gyro/itg3200_core.c +0 −1
  174. drivers/iio/gyro/mpu3050-core.c +0 −2
  175. drivers/iio/gyro/st_gyro_core.c +36 −11
  176. drivers/iio/health/afe4403.c +0 −2
  177. drivers/iio/health/afe4404.c +0 −2
  178. drivers/iio/health/max30100.c +0 −1
  179. drivers/iio/health/max30102.c +0 −1
  180. drivers/iio/humidity/am2315.c +0 −1
  181. drivers/iio/humidity/dht11.c +0 −1
  182. drivers/iio/humidity/hdc100x.c +0 −1
  183. drivers/iio/humidity/hid-sensor-humidity.c +0 −1
  184. drivers/iio/humidity/hts221_buffer.c +0 −1
  185. drivers/iio/humidity/hts221_core.c +0 −1
  186. drivers/iio/humidity/htu21.c +0 −1
  187. drivers/iio/humidity/si7005.c +0 −1
  188. drivers/iio/humidity/si7020.c +0 −1
  189. drivers/iio/imu/adis16400_core.c +0 −1
  190. drivers/iio/imu/adis16480.c +0 −1
  191. drivers/iio/imu/adis_trigger.c +0 −1
  192. drivers/iio/imu/bmi160/bmi160_core.c +0 −1
  193. drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +8 −5
  194. drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +0 −1
  195. drivers/iio/imu/kmx61.c +0 −3
  196. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +28 −4
  197. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +36 −36
  198. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +70 −28
  199. drivers/iio/industrialio-core.c +9 −26
  200. drivers/iio/industrialio-trigger.c +19 −16
  201. drivers/iio/light/acpi-als.c +0 −1
  202. drivers/iio/light/adjd_s311.c +0 −1
  203. drivers/iio/light/al3320a.c +0 −1
  204. drivers/iio/light/apds9300.c +0 −2
  205. drivers/iio/light/apds9960.c +0 −1
  206. drivers/iio/light/bh1750.c +0 −1
  207. drivers/iio/light/bh1780.c +0 −1
  208. drivers/iio/light/cm32181.c +0 −1
  209. drivers/iio/light/cm3232.c +0 −1
  210. drivers/iio/light/cm3323.c +0 −1
  211. drivers/iio/light/cm3605.c +0 −1
  212. drivers/iio/light/cm36651.c +0 −1
  213. drivers/iio/light/cros_ec_light_prox.c +0 −1
  214. drivers/iio/light/gp2ap020a00f.c +0 −2
  215. drivers/iio/light/hid-sensor-als.c +0 −1
  216. drivers/iio/light/hid-sensor-prox.c +0 −1
  217. drivers/iio/light/isl29018.c +0 −2
  218. drivers/iio/light/isl29028.c +0 −1
  219. drivers/iio/light/isl29125.c +0 −1
  220. drivers/iio/light/jsa1212.c +0 −1
  221. drivers/iio/light/lm3533-als.c +0 −1
  222. drivers/iio/light/ltr501.c +0 −4
  223. drivers/iio/light/max44000.c +0 −1
  224. drivers/iio/light/opt3001.c +0 −1
  225. drivers/iio/light/pa12203001.c +0 −1
  226. drivers/iio/light/rpr0521.c +0 −2
  227. drivers/iio/light/si1145.c +0 −3
  228. drivers/iio/light/stk3310.c +0 −1
  229. drivers/iio/light/tcs3414.c +0 −1
  230. drivers/iio/light/tcs3472.c +254 −9
  231. drivers/iio/light/tsl2563.c +0 −2
  232. drivers/iio/light/tsl2583.c +0 −1
  233. drivers/iio/light/tsl4531.c +0 −1
  234. drivers/iio/light/us5182d.c +0 −1
  235. drivers/iio/light/vcnl4000.c +0 −1
  236. drivers/iio/light/veml6070.c +0 −1
  237. drivers/iio/light/vl6180.c +69 −58
  238. drivers/iio/magnetometer/ak8974.c +0 −1
  239. drivers/iio/magnetometer/ak8975.c +0 −1
  240. drivers/iio/magnetometer/bmc150_magn.c +0 −2
  241. drivers/iio/magnetometer/hid-sensor-magn-3d.c +0 −1
  242. drivers/iio/magnetometer/hmc5843_core.c +0 −1
  243. drivers/iio/magnetometer/mag3110.c +0 −1
  244. drivers/iio/magnetometer/mmc35240.c +0 −1
  245. drivers/iio/magnetometer/st_magn_core.c +16 −6
  246. drivers/iio/multiplexer/iio-mux.c +6 −1
  247. drivers/iio/orientation/hid-sensor-incl-3d.c +0 −1
  248. drivers/iio/orientation/hid-sensor-rotation.c +0 −1
  249. drivers/iio/potentiometer/ds1803.c +0 −1
  250. drivers/iio/potentiometer/max5481.c +0 −2
  251. drivers/iio/potentiometer/max5487.c +0 −2
  252. drivers/iio/potentiometer/mcp4131.c +0 −1
  253. drivers/iio/potentiometer/mcp4531.c +0 −1
  254. drivers/iio/potentiometer/tpl0102.c +0 −1
  255. drivers/iio/potentiostat/lmp91000.c +0 −2
  256. drivers/iio/pressure/abp060mg.c +0 −1
  257. drivers/iio/pressure/bmp280-core.c +0 −1
  258. drivers/iio/pressure/cros_ec_baro.c +0 −3
  259. drivers/iio/pressure/hid-sensor-press.c +0 −1
  260. drivers/iio/pressure/hp03.c +0 −1
  261. drivers/iio/pressure/hp206c.c +0 −1
  262. drivers/iio/pressure/mpl115.c +0 −1
  263. drivers/iio/pressure/mpl3115.c +0 −1
  264. drivers/iio/pressure/ms5611_core.c +0 −1
  265. drivers/iio/pressure/ms5637.c +0 −1
  266. drivers/iio/pressure/st_pressure.h +4 −0
  267. drivers/iio/pressure/st_pressure_core.c +55 −23
  268. drivers/iio/pressure/st_pressure_i2c.c +10 −0
  269. drivers/iio/pressure/st_pressure_spi.c +10 −0
  270. drivers/iio/pressure/t5403.c +0 −1
  271. drivers/iio/pressure/zpa2326.c +0 −2
  272. drivers/iio/proximity/Kconfig +10 −0
  273. drivers/iio/proximity/Makefile +1 −0
  274. drivers/iio/proximity/as3935.c +0 −2
  275. drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +0 −1
  276. drivers/iio/proximity/rfd77402.c +352 −0
  277. drivers/iio/proximity/srf04.c +0 −1
  278. drivers/iio/proximity/srf08.c +0 −2
  279. drivers/iio/proximity/sx9500.c +0 −2
  280. drivers/iio/temperature/hid-sensor-temperature.c +0 −1
  281. drivers/iio/temperature/maxim_thermocouple.c +0 −1
  282. drivers/iio/temperature/mlx90614.c +0 −1
  283. drivers/iio/temperature/tmp006.c +0 −1
  284. drivers/iio/temperature/tmp007.c +0 −1
  285. drivers/iio/temperature/tsys01.c +0 −1
  286. drivers/iio/temperature/tsys02d.c +0 −1
  287. drivers/iio/trigger/iio-trig-hrtimer.c +0 −1
  288. drivers/iio/trigger/iio-trig-interrupt.c +0 −1
  289. drivers/iio/trigger/iio-trig-loop.c +0 −1
  290. drivers/iio/trigger/iio-trig-sysfs.c +0 −1
  291. drivers/iio/trigger/stm32-lptimer-trigger.c +0 −1
  292. drivers/iio/trigger/stm32-timer-trigger.c +0 −2
  293. drivers/input/touchscreen/tsc2007_iio.c +0 −1
  294. drivers/misc/Kconfig +0 −10
  295. drivers/misc/Makefile +0 −1
  296. drivers/misc/ti_dac7512.c +0 −103
  297. drivers/platform/x86/toshiba_acpi.c +0 −1
  298. drivers/staging/android/TODO +0 −1
  299. drivers/staging/android/ion/ion-ioctl.c +5 −6
  300. drivers/staging/android/ion/ion.c +0 −2
  301. drivers/staging/android/ion/ion.h +1 −1
  302. drivers/staging/ccree/cc_hal.h +0 −33
  303. drivers/staging/ccree/cc_lli_defs.h +1 −1
  304. drivers/staging/ccree/cc_regs.h +0 −42
  305. drivers/staging/ccree/dx_reg_base_host.h +0 −25
  306. drivers/staging/ccree/ssi_aead.c +144 −114
  307. drivers/staging/ccree/ssi_buffer_mgr.c +208 −230
  308. drivers/staging/ccree/ssi_buffer_mgr.h +4 −1
  309. drivers/staging/ccree/ssi_cipher.c +95 −94
  310. drivers/staging/ccree/ssi_cipher.h +7 −6
  311. drivers/staging/ccree/ssi_driver.c +165 −216
  312. drivers/staging/ccree/ssi_driver.h +29 −26
  313. drivers/staging/ccree/ssi_fips.c +12 −14
  314. drivers/staging/ccree/ssi_fips.h +2 −2
  315. drivers/staging/ccree/ssi_hash.c +182 −195
  316. drivers/staging/ccree/ssi_ivgen.c +8 −10
  317. drivers/staging/ccree/ssi_pm.c +18 −17
  318. drivers/staging/ccree/ssi_request_mgr.c +104 −91
  319. drivers/staging/ccree/ssi_sram_mgr.c +10 −23
  320. drivers/staging/ccree/ssi_sysfs.c +8 −274
  321. drivers/staging/comedi/Kconfig +2 −2
  322. drivers/staging/comedi/drivers/adv_pci_dio.c +24 −2
  323. drivers/staging/comedi/drivers/comedi_test.c +10 −8
  324. drivers/staging/comedi/drivers/das16.c +8 −9
  325. drivers/staging/comedi/drivers/dt282x.c +2 −0
  326. drivers/staging/comedi/drivers/jr3_pci.c +6 −4
  327. drivers/staging/comedi/drivers/s526.c +2 −3
  328. drivers/staging/dgnc/dgnc_driver.c +3 −5
  329. drivers/staging/dgnc/dgnc_driver.h +0 −16
  330. drivers/staging/dgnc/dgnc_neo.c +4 −7
  331. drivers/staging/fbtft/fb_ra8875.c +5 −5
  332. drivers/staging/fbtft/fb_ssd1331.c +7 −1
  333. drivers/staging/fbtft/fb_uc1611.c +1 −1
  334. drivers/staging/fbtft/fb_uc1701.c +1 −1
  335. drivers/staging/fbtft/fbtft-bus.c +12 −12
  336. drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +166 −115
  337. drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h +39 −15
  338. drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c +13 −1
  339. drivers/staging/fsl-dpaa2/ethernet/dpni-cmd.h +5 −0
  340. drivers/staging/fsl-dpaa2/ethernet/dpni.c +32 −0
  341. drivers/staging/fsl-dpaa2/ethernet/dpni.h +5 −0
  342. drivers/staging/fsl-mc/bus/dpio/dpio-service.c +2 −2
  343. drivers/staging/fsl-mc/bus/fsl-mc-msi.c +1 −1
  344. drivers/staging/fsl-mc/include/dpaa2-io.h +4 −2
  345. drivers/staging/fwserial/fwserial.c +4 −12
  346. drivers/staging/gdm724x/gdm_lte.c +12 −7
  347. drivers/staging/greybus/Documentation/firmware/authenticate.c +1 −0
  348. drivers/staging/greybus/Documentation/firmware/firmware.c +1 −0
  349. drivers/staging/greybus/arche-apb-ctrl.c +1 −2
  350. drivers/staging/greybus/arche-platform.c +1 −2
  351. drivers/staging/greybus/arche_platform.h +1 −2
  352. drivers/staging/greybus/arpc.h +1 −0
  353. drivers/staging/greybus/audio_apbridgea.c +1 −2
  354. drivers/staging/greybus/audio_apbridgea.h +1 −0
  355. drivers/staging/greybus/audio_codec.c +1 −2
  356. drivers/staging/greybus/audio_codec.h +1 −2
  357. drivers/staging/greybus/audio_gb.c +1 −2
  358. drivers/staging/greybus/audio_manager.c +2 −3
  359. drivers/staging/greybus/audio_manager.h +1 −2
  360. drivers/staging/greybus/audio_manager_module.c +1 −2
  361. drivers/staging/greybus/audio_manager_private.h +1 −2
  362. drivers/staging/greybus/audio_manager_sysfs.c +1 −2
  363. drivers/staging/greybus/audio_module.c +1 −2
  364. drivers/staging/greybus/audio_topology.c +1 −2
  365. drivers/staging/greybus/authentication.c +1 −2
  366. drivers/staging/greybus/bootrom.c +1 −2
  367. drivers/staging/greybus/bundle.c +1 −2
  368. drivers/staging/greybus/bundle.h +1 −2
  369. drivers/staging/greybus/camera.c +1 −2
  370. drivers/staging/greybus/connection.c +1 −2
  371. drivers/staging/greybus/connection.h +1 −2
  372. drivers/staging/greybus/control.c +1 −2
  373. drivers/staging/greybus/control.h +1 −2
  374. drivers/staging/greybus/core.c +1 −2
  375. drivers/staging/greybus/debugfs.c +1 −2
  376. drivers/staging/greybus/es2.c +2 −2
  377. drivers/staging/greybus/firmware.h +1 −2
  378. drivers/staging/greybus/fw-core.c +1 −2
  379. drivers/staging/greybus/fw-download.c +1 −2
  380. drivers/staging/greybus/fw-management.c +1 −2
  381. drivers/staging/greybus/gb-camera.h +1 −2
  382. drivers/staging/greybus/gbphy.c +1 −2
  383. drivers/staging/greybus/gbphy.h +1 −2
  384. drivers/staging/greybus/gpio.c +1 −2
  385. drivers/staging/greybus/greybus.h +1 −2
  386. drivers/staging/greybus/greybus_authentication.h +1 −0
  387. drivers/staging/greybus/greybus_firmware.h +1 −0
  388. drivers/staging/greybus/greybus_manifest.h +1 −0
  389. drivers/staging/greybus/greybus_protocols.h +1 −0
  390. drivers/staging/greybus/greybus_trace.h +1 −2
  391. drivers/staging/greybus/hd.c +1 −2
  392. drivers/staging/greybus/hd.h +1 −2
  393. drivers/staging/greybus/hid.c +1 −2
  394. drivers/staging/greybus/i2c.c +1 −2
  395. drivers/staging/greybus/interface.c +1 −2
  396. drivers/staging/greybus/interface.h +1 −2
  397. drivers/staging/greybus/light.c +4 −7
  398. drivers/staging/greybus/log.c +1 −2
  399. drivers/staging/greybus/loopback.c +52 −190
  400. drivers/staging/greybus/manifest.c +1 −2
  401. drivers/staging/greybus/manifest.h +1 −2
  402. drivers/staging/greybus/module.c +1 −2
  403. drivers/staging/greybus/module.h +1 −2
  404. drivers/staging/greybus/operation.c +1 −2
  405. drivers/staging/greybus/operation.h +14 −2
  406. drivers/staging/greybus/power_supply.c +1 −2
  407. drivers/staging/greybus/pwm.c +1 −2
  408. drivers/staging/greybus/raw.c +1 −2
  409. drivers/staging/greybus/sdio.c +1 −2
  410. drivers/staging/greybus/spi.c +1 −2
  411. drivers/staging/greybus/spilib.c +6 −5
  412. drivers/staging/greybus/spilib.h +1 −0
  413. drivers/staging/greybus/svc.c +1 −2
  414. drivers/staging/greybus/svc.h +1 −2
  415. drivers/staging/greybus/svc_watchdog.c +1 −2
  416. drivers/staging/greybus/tools/lbtest +1 −0
  417. drivers/staging/greybus/tools/loopback_test.c +1 −0
  418. drivers/staging/greybus/uart.c +1 −2
  419. drivers/staging/greybus/usb.c +1 −3
  420. drivers/staging/greybus/vibrator.c +1 −2
  421. drivers/staging/gs_fpgaboot/gs_fpgaboot.c +1 −1
  422. drivers/staging/iio/Documentation/device.txt +0 −3
  423. drivers/staging/iio/Documentation/trigger.txt +0 −4
  424. drivers/staging/iio/accel/adis16201.c +0 −1
  425. drivers/staging/iio/accel/adis16203.c +0 −1
  426. drivers/staging/iio/accel/adis16209.c +0 −1
  427. drivers/staging/iio/accel/adis16240.c +0 −1
  428. drivers/staging/iio/adc/ad7192.c +7 −4
  429. drivers/staging/iio/adc/ad7280a.c +0 −1
  430. drivers/staging/iio/adc/ad7606.c +0 −4
  431. drivers/staging/iio/adc/ad7780.c +0 −1
  432. drivers/staging/iio/adc/ad7816.c +0 −1
  433. drivers/staging/iio/addac/adt7316.c +0 −2
  434. drivers/staging/iio/cdc/ad7150.c +0 −1
  435. drivers/staging/iio/cdc/ad7152.c +0 −1
  436. drivers/staging/iio/cdc/ad7746.c +0 −1
  437. drivers/staging/iio/frequency/ad9832.c +0 −1
  438. drivers/staging/iio/frequency/ad9834.c +0 −2
  439. drivers/staging/iio/gyro/adis16060_core.c +0 −1
  440. drivers/staging/iio/impedance-analyzer/ad5933.c +0 −1
  441. drivers/staging/iio/light/tsl2x7x.c +255 −410
  442. drivers/staging/iio/light/tsl2x7x.h +7 −6
  443. drivers/staging/iio/meter/ade7753.c +18 −9
  444. drivers/staging/iio/meter/ade7754.c +0 −1
  445. drivers/staging/iio/meter/ade7758_core.c +0 −1
  446. drivers/staging/iio/meter/ade7758_trigger.c +0 −1
  447. drivers/staging/iio/meter/ade7759.c +19 −9
  448. drivers/staging/iio/meter/ade7854.c +0 −1
  449. drivers/staging/iio/resolver/ad2s1200.c +0 −1
  450. drivers/staging/iio/resolver/ad2s1210.c +0 −1
  451. drivers/staging/iio/resolver/ad2s90.c +0 −1
  452. drivers/staging/iio/trigger/iio-trig-bfin-timer.c +0 −1
  453. drivers/staging/irda/drivers/ali-ircc.c +1 −2
  454. drivers/staging/irda/drivers/au1k_ir.c +18 −22
  455. drivers/staging/irda/drivers/bfin_sir.c +7 −5
  456. drivers/staging/irda/drivers/esi-sir.c +11 −11
  457. drivers/staging/irda/drivers/irda-usb.c +8 −16
  458. drivers/staging/irda/drivers/irda-usb.h +1 −0
  459. drivers/staging/irda/drivers/mcs7780.c +6 −3
  460. drivers/staging/irda/drivers/vlsi_ir.c +9 −9
  461. drivers/staging/irda/include/net/irda/irlmp_event.h +3 −3
  462. drivers/staging/irda/include/net/irda/qos.h +10 −10
  463. drivers/staging/irda/include/net/irda/timer.h +4 −7
  464. drivers/staging/irda/net/af_irda.c +3 −4
  465. drivers/staging/irda/net/discovery.c +2 −2
  466. drivers/staging/irda/net/ircomm/ircomm_tty.c +1 −1
  467. drivers/staging/irda/net/ircomm/ircomm_tty_attach.c +4 −4
  468. drivers/staging/irda/net/irda_device.c +18 −18
  469. drivers/staging/irda/net/iriap.c +5 −5
  470. drivers/staging/irda/net/irlan/irlan_client.c +3 −3
  471. drivers/staging/irda/net/irlan/irlan_common.c +2 −2
  472. drivers/staging/irda/net/irlap.c +8 −8
  473. drivers/staging/irda/net/irlap_event.c +3 −3
  474. drivers/staging/irda/net/irlmp.c +4 −4
  475. drivers/staging/irda/net/irlmp_event.c +5 −5
  476. drivers/staging/irda/net/irqueue.c +2 −1
  477. drivers/staging/irda/net/irttp.c +3 −8
  478. drivers/staging/irda/net/timer.c +27 −27
  479. drivers/staging/ks7010/ks_wlan_net.c +12 −3
  480. drivers/staging/lustre/include/linux/libcfs/curproc.h +1 −0
  481. drivers/staging/lustre/include/linux/libcfs/libcfs.h +1 −0
  482. drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +1 −0
  483. drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h +1 −0
  484. drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +1 −0
  485. drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +1 −0
  486. drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +1 −0
  487. drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h +1 −0
  488. drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +1 −0
  489. drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +1 −0
  490. drivers/staging/lustre/include/linux/libcfs/libcfs_time.h +1 −0
  491. drivers/staging/lustre/include/linux/libcfs/libcfs_workitem.h +1 −0
  492. drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h +1 −0
  493. drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h +1 −0
  494. drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h +1 −0
  495. drivers/staging/lustre/include/linux/lnet/api.h +1 −0
  496. drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 −0
  497. drivers/staging/lustre/include/linux/lnet/lib-types.h +14 −15
  498. drivers/staging/lustre/include/linux/lnet/socklnd.h +1 −0
  499. drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 −0
  500. drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +1 −0
  501. drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 −0
  502. drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +1 −0
  503. drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +5 −12
  504. drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +1 −0
  505. drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +1 −0
  506. drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +1 −0
  507. drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +1 −0
  508. drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +1 −0
  509. drivers/staging/lustre/lnet/libcfs/debug.c +1 −0
  510. drivers/staging/lustre/lnet/libcfs/fail.c +1 −0
  511. drivers/staging/lustre/lnet/libcfs/hash.c +1 −0
  512. drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +1 −0
  513. drivers/staging/lustre/lnet/libcfs/libcfs_lock.c +1 −0
  514. drivers/staging/lustre/lnet/libcfs/libcfs_mem.c +1 −0
  515. drivers/staging/lustre/lnet/libcfs/libcfs_string.c +1 −0
  516. drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +1 −0
  517. drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c +1 −0
  518. drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +1 −0
  519. drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.h +1 −0
  520. drivers/staging/lustre/lnet/libcfs/linux/linux-curproc.c +1 −0
  521. drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c +1 −0
  522. drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c +1 −0
  523. drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +1 −0
  524. drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c +1 −0
  525. drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c +1 −0
  526. drivers/staging/lustre/lnet/libcfs/module.c +1 −0
  527. drivers/staging/lustre/lnet/libcfs/prng.c +1 −0
  528. drivers/staging/lustre/lnet/libcfs/tracefile.c +1 −0
  529. drivers/staging/lustre/lnet/libcfs/tracefile.h +1 −0
  530. drivers/staging/lustre/lnet/libcfs/workitem.c +1 −0
  531. drivers/staging/lustre/lnet/lnet/acceptor.c +1 −0
  532. drivers/staging/lustre/lnet/lnet/api-ni.c +1 −0
  533. drivers/staging/lustre/lnet/lnet/config.c +1 −0
  534. drivers/staging/lustre/lnet/lnet/lib-eq.c +1 −0
  535. drivers/staging/lustre/lnet/lnet/lib-md.c +1 −0
  536. drivers/staging/lustre/lnet/lnet/lib-me.c +1 −0
  537. drivers/staging/lustre/lnet/lnet/lib-move.c +1 −0
  538. drivers/staging/lustre/lnet/lnet/lib-msg.c +1 −0
  539. drivers/staging/lustre/lnet/lnet/lib-ptl.c +1 −0
  540. drivers/staging/lustre/lnet/lnet/lib-socket.c +1 −0
  541. drivers/staging/lustre/lnet/lnet/lo.c +1 −0
  542. drivers/staging/lustre/lnet/lnet/module.c +1 −0
  543. drivers/staging/lustre/lnet/lnet/net_fault.c +2 −0
  544. drivers/staging/lustre/lnet/lnet/nidstrings.c +1 −0
  545. drivers/staging/lustre/lnet/lnet/peer.c +1 −0
  546. drivers/staging/lustre/lnet/lnet/router.c +3 −7
  547. drivers/staging/lustre/lnet/lnet/router_proc.c +1 −0
  548. drivers/staging/lustre/lnet/selftest/brw_test.c +1 −0
  549. drivers/staging/lustre/lnet/selftest/conctl.c +2 −0
  550. drivers/staging/lustre/lnet/selftest/conrpc.c +1 −0
  551. drivers/staging/lustre/lnet/selftest/conrpc.h +1 −0
  552. drivers/staging/lustre/lnet/selftest/console.c +1 −0
  553. drivers/staging/lustre/lnet/selftest/console.h +1 −0
  554. drivers/staging/lustre/lnet/selftest/framework.c +1 −0
  555. drivers/staging/lustre/lnet/selftest/module.c +5 −1
  556. drivers/staging/lustre/lnet/selftest/ping_test.c +1 −0
  557. drivers/staging/lustre/lnet/selftest/rpc.c +10 −4
  558. drivers/staging/lustre/lnet/selftest/rpc.h +1 −0
  559. drivers/staging/lustre/lnet/selftest/selftest.h +1 −0
  560. drivers/staging/lustre/lnet/selftest/timer.c +1 −0
  561. drivers/staging/lustre/lnet/selftest/timer.h +1 −0
  562. drivers/staging/lustre/lustre/fid/fid_internal.h +1 −0
  563. drivers/staging/lustre/lustre/fid/fid_lib.c +1 −0
  564. drivers/staging/lustre/lustre/fid/fid_request.c +3 −1
  565. drivers/staging/lustre/lustre/fid/lproc_fid.c +1 −0
  566. drivers/staging/lustre/lustre/fld/fld_cache.c +1 −0
  567. drivers/staging/lustre/lustre/fld/fld_internal.h +1 −0
  568. drivers/staging/lustre/lustre/fld/fld_request.c +3 −1
  569. drivers/staging/lustre/lustre/fld/lproc_fld.c +1 −0
  570. drivers/staging/lustre/lustre/include/cl_object.h +1 −0
  571. drivers/staging/lustre/lustre/include/interval_tree.h +1 −0
  572. drivers/staging/lustre/lustre/include/llog_swab.h +1 −0
  573. drivers/staging/lustre/lustre/include/lprocfs_status.h +1 −0
  574. drivers/staging/lustre/lustre/include/lu_object.h +2 −3
  575. drivers/staging/lustre/lustre/include/lu_ref.h +1 −0
  576. drivers/staging/lustre/lustre/include/lustre_acl.h +1 −0
  577. drivers/staging/lustre/lustre/include/lustre_compat.h +1 −0
  578. drivers/staging/lustre/lustre/include/lustre_debug.h +1 −0
  579. drivers/staging/lustre/lustre/include/lustre_disk.h +1 −0
  580. drivers/staging/lustre/lustre/include/lustre_dlm.h +1 −0
  581. drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +5 −2
  582. drivers/staging/lustre/lustre/include/lustre_errno.h +17 −34
  583. drivers/staging/lustre/lustre/include/lustre_export.h +1 −0
  584. drivers/staging/lustre/lustre/include/lustre_fid.h +1 −0
  585. drivers/staging/lustre/lustre/include/lustre_fld.h +1 −0
  586. drivers/staging/lustre/lustre/include/lustre_ha.h +1 −0
  587. drivers/staging/lustre/lustre/include/lustre_handles.h +1 −0
  588. drivers/staging/lustre/lustre/include/lustre_import.h +1 −0
  589. drivers/staging/lustre/lustre/include/lustre_intent.h +1 −0
  590. drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +1 −0
  591. drivers/staging/lustre/lustre/include/lustre_lib.h +1 −0
  592. drivers/staging/lustre/lustre/include/lustre_linkea.h +1 −0
  593. drivers/staging/lustre/lustre/include/lustre_lmv.h +1 −0
  594. drivers/staging/lustre/lustre/include/lustre_log.h +1 −0
  595. drivers/staging/lustre/lustre/include/lustre_mdc.h +1 −0
  596. drivers/staging/lustre/lustre/include/lustre_mds.h +1 −0
  597. drivers/staging/lustre/lustre/include/lustre_net.h +1 −0
  598. drivers/staging/lustre/lustre/include/lustre_nrs.h +1 −0
  599. drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h +1 −0
  600. drivers/staging/lustre/lustre/include/lustre_obdo.h +1 −0
  601. drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +1 −0
  602. drivers/staging/lustre/lustre/include/lustre_req_layout.h +1 −0
  603. drivers/staging/lustre/lustre/include/lustre_sec.h +1 −0
  604. drivers/staging/lustre/lustre/include/lustre_swab.h +1 −0
  605. drivers/staging/lustre/lustre/include/obd.h +1 −0
  606. drivers/staging/lustre/lustre/include/obd_cksum.h +1 −0
  607. drivers/staging/lustre/lustre/include/obd_class.h +1 −0
  608. drivers/staging/lustre/lustre/include/obd_support.h +1 −0
  609. drivers/staging/lustre/lustre/include/seq_range.h +1 −0
  610. drivers/staging/lustre/lustre/ldlm/interval_tree.c +1 −0
  611. drivers/staging/lustre/lustre/ldlm/l_lock.c +1 −0
  612. drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +3 −1
  613. drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +47 −168
  614. drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c +1 −0
  615. drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +2 −1
  616. drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +1 −0
  617. drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +23 −11
  618. drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +5 −2
  619. drivers/staging/lustre/lustre/ldlm/ldlm_plain.c +1 −0
  620. drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +5 −2
  621. drivers/staging/lustre/lustre/ldlm/ldlm_request.c +28 −16
  622. drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +3 −1
  623. drivers/staging/lustre/lustre/llite/dcache.c +7 −3
  624. drivers/staging/lustre/lustre/llite/dir.c +12 −9
  625. drivers/staging/lustre/lustre/llite/file.c +9 −5
  626. drivers/staging/lustre/lustre/llite/glimpse.c +1 −0
  627. drivers/staging/lustre/lustre/llite/lcommon_cl.c +1 −0
  628. drivers/staging/lustre/lustre/llite/lcommon_misc.c +1 −0
  629. drivers/staging/lustre/lustre/llite/llite_internal.h +12 −7
  630. drivers/staging/lustre/lustre/llite/llite_lib.c +20 −10
  631. drivers/staging/lustre/lustre/llite/llite_mmap.c +3 −1
  632. drivers/staging/lustre/lustre/llite/llite_nfs.c +3 −1
  633. drivers/staging/lustre/lustre/llite/lproc_llite.c +1 −0
  634. drivers/staging/lustre/lustre/llite/namei.c +14 −6
  635. drivers/staging/lustre/lustre/llite/range_lock.c +1 −0
  636. drivers/staging/lustre/lustre/llite/range_lock.h +1 −0
  637. drivers/staging/lustre/lustre/llite/rw.c +12 −6
  638. drivers/staging/lustre/lustre/llite/rw26.c +1 −0
  639. drivers/staging/lustre/lustre/llite/statahead.c +3 −1
  640. drivers/staging/lustre/lustre/llite/super25.c +3 −1
  641. drivers/staging/lustre/lustre/llite/symlink.c +1 −0
  642. drivers/staging/lustre/lustre/llite/vvp_dev.c +1 −0
  643. drivers/staging/lustre/lustre/llite/vvp_internal.h +1 −0
  644. drivers/staging/lustre/lustre/llite/vvp_io.c +1 −0
  645. drivers/staging/lustre/lustre/llite/vvp_lock.c +1 −0
  646. drivers/staging/lustre/lustre/llite/vvp_object.c +1 −0
  647. drivers/staging/lustre/lustre/llite/vvp_page.c +1 −0
  648. drivers/staging/lustre/lustre/llite/xattr.c +1 −0
  649. drivers/staging/lustre/lustre/llite/xattr_cache.c +2 −1
  650. drivers/staging/lustre/lustre/llite/xattr_security.c +1 −0
  651. drivers/staging/lustre/lustre/lmv/lmv_fld.c +1 −0
  652. drivers/staging/lustre/lustre/lmv/lmv_intent.c +1 −0
  653. drivers/staging/lustre/lustre/lmv/lmv_internal.h +1 −0
  654. drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 −0
  655. drivers/staging/lustre/lustre/lmv/lproc_lmv.c +1 −0
  656. drivers/staging/lustre/lustre/lov/lov_cl_internal.h +1 −0
  657. drivers/staging/lustre/lustre/lov/lov_dev.c +1 −0
  658. drivers/staging/lustre/lustre/lov/lov_ea.c +1 −0
  659. drivers/staging/lustre/lustre/lov/lov_internal.h +1 −0
  660. drivers/staging/lustre/lustre/lov/lov_io.c +1 −0
  661. drivers/staging/lustre/lustre/lov/lov_lock.c +1 −0
  662. drivers/staging/lustre/lustre/lov/lov_merge.c +1 −0
  663. drivers/staging/lustre/lustre/lov/lov_obd.c +1 −0
  664. drivers/staging/lustre/lustre/lov/lov_object.c +1 −0
  665. drivers/staging/lustre/lustre/lov/lov_offset.c +1 −0
  666. drivers/staging/lustre/lustre/lov/lov_pack.c +1 −0
  667. drivers/staging/lustre/lustre/lov/lov_page.c +1 −0
  668. drivers/staging/lustre/lustre/lov/lov_pool.c +1 −0
  669. drivers/staging/lustre/lustre/lov/lov_request.c +1 −0
  670. drivers/staging/lustre/lustre/lov/lovsub_dev.c +1 −0
  671. drivers/staging/lustre/lustre/lov/lovsub_lock.c +1 −0
  672. drivers/staging/lustre/lustre/lov/lovsub_object.c +1 −0
  673. drivers/staging/lustre/lustre/lov/lovsub_page.c +1 −0
  674. drivers/staging/lustre/lustre/lov/lproc_lov.c +1 −0
  675. drivers/staging/lustre/lustre/mdc/lproc_mdc.c +1 −0
  676. drivers/staging/lustre/lustre/mdc/mdc_internal.h +1 −0
  677. drivers/staging/lustre/lustre/mdc/mdc_lib.c +1 −0
  678. drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 −0
  679. drivers/staging/lustre/lustre/mdc/mdc_reint.c +1 −0
  680. drivers/staging/lustre/lustre/mdc/mdc_request.c +1 −0
  681. drivers/staging/lustre/lustre/mgc/lproc_mgc.c +1 −0
  682. drivers/staging/lustre/lustre/mgc/mgc_internal.h +1 −0
  683. drivers/staging/lustre/lustre/mgc/mgc_request.c +1 −0
  684. drivers/staging/lustre/lustre/obdclass/cl_internal.h +1 −0
  685. drivers/staging/lustre/lustre/obdclass/cl_io.c +1 −0
  686. drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 −0
  687. drivers/staging/lustre/lustre/obdclass/cl_object.c +1 −0
  688. drivers/staging/lustre/lustre/obdclass/cl_page.c +1 −0
  689. drivers/staging/lustre/lustre/obdclass/class_obd.c +1 −0
  690. drivers/staging/lustre/lustre/obdclass/debug.c +1 −0
  691. drivers/staging/lustre/lustre/obdclass/genops.c +1 −0
  692. drivers/staging/lustre/lustre/obdclass/kernelcomm.c +1 −0
  693. drivers/staging/lustre/lustre/obdclass/linkea.c +1 −0
  694. drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 −0
  695. drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +1 −0
  696. drivers/staging/lustre/lustre/obdclass/llog.c +1 −0
  697. drivers/staging/lustre/lustre/obdclass/llog_cat.c +1 −0
  698. drivers/staging/lustre/lustre/obdclass/llog_internal.h +1 −0
  699. drivers/staging/lustre/lustre/obdclass/llog_obd.c +1 −0
  700. drivers/staging/lustre/lustre/obdclass/llog_swab.c +1 −0
  701. drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c +1 −0
  702. drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +5 −0
  703. drivers/staging/lustre/lustre/obdclass/lu_object.c +1 −0
  704. drivers/staging/lustre/lustre/obdclass/lu_ref.c +1 −0
  705. drivers/staging/lustre/lustre/obdclass/lustre_handles.c +1 −0
  706. drivers/staging/lustre/lustre/obdclass/lustre_peer.c +1 −0
  707. drivers/staging/lustre/lustre/obdclass/obd_config.c +1 −0
  708. drivers/staging/lustre/lustre/obdclass/obd_mount.c +1 −0
  709. drivers/staging/lustre/lustre/obdclass/obdo.c +1 −0
  710. drivers/staging/lustre/lustre/obdclass/statfs_pack.c +1 −0
  711. drivers/staging/lustre/lustre/obdclass/uuid.c +1 −0
  712. drivers/staging/lustre/lustre/obdecho/echo_client.c +1 −0
  713. drivers/staging/lustre/lustre/obdecho/echo_internal.h +1 −0
  714. drivers/staging/lustre/lustre/osc/lproc_osc.c +1 −0
  715. drivers/staging/lustre/lustre/osc/osc_cache.c +2 −0
  716. drivers/staging/lustre/lustre/osc/osc_cl_internal.h +1 −0
  717. drivers/staging/lustre/lustre/osc/osc_dev.c +1 −0
  718. drivers/staging/lustre/lustre/osc/osc_internal.h +1 −0
  719. drivers/staging/lustre/lustre/osc/osc_io.c +1 −0
  720. drivers/staging/lustre/lustre/osc/osc_lock.c +1 −0
  721. drivers/staging/lustre/lustre/osc/osc_object.c +1 −0
  722. drivers/staging/lustre/lustre/osc/osc_page.c +1 −0
  723. drivers/staging/lustre/lustre/osc/osc_quota.c +1 −0
  724. drivers/staging/lustre/lustre/osc/osc_request.c +1 −0
  725. drivers/staging/lustre/lustre/ptlrpc/client.c +1 −0
  726. drivers/staging/lustre/lustre/ptlrpc/connection.c +1 −0
  727. drivers/staging/lustre/lustre/ptlrpc/errno.c +1 −0
  728. drivers/staging/lustre/lustre/ptlrpc/events.c +1 −0
  729. drivers/staging/lustre/lustre/ptlrpc/import.c +1 −0
  730. drivers/staging/lustre/lustre/ptlrpc/layout.c +1 −0
  731. drivers/staging/lustre/lustre/ptlrpc/llog_client.c +1 −0
  732. drivers/staging/lustre/lustre/ptlrpc/llog_net.c +1 −0
  733. drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +1 −0
  734. drivers/staging/lustre/lustre/ptlrpc/niobuf.c +1 −0
  735. drivers/staging/lustre/lustre/ptlrpc/nrs.c +1 −0
  736. drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +1 −0
  737. drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +4 −3
  738. drivers/staging/lustre/lustre/ptlrpc/pers.c +1 −0
  739. drivers/staging/lustre/lustre/ptlrpc/pinger.c +1 −0
  740. drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +1 −0
  741. drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +1 −0
  742. drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +1 −0
  743. drivers/staging/lustre/lustre/ptlrpc/recover.c +1 −0
  744. drivers/staging/lustre/lustre/ptlrpc/sec.c +2 −1
  745. drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 −0
  746. drivers/staging/lustre/lustre/ptlrpc/sec_config.c +1 −0
  747. drivers/staging/lustre/lustre/ptlrpc/sec_gc.c +1 −0
  748. drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c +1 −0
  749. drivers/staging/lustre/lustre/ptlrpc/sec_null.c +1 −0
  750. drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +1 −0
  751. drivers/staging/lustre/lustre/ptlrpc/service.c +1 −0
  752. drivers/staging/lustre/lustre/ptlrpc/wiretest.c +1 −0
  753. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +19 −8
  754. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +2 −2
  755. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +4 −4
  756. drivers/staging/media/bcm2048/radio-bcm2048.c +30 −30
  757. drivers/staging/netlogic/xlr_net.c +38 −44
  758. drivers/staging/pi433/Documentation/pi433.txt +12 −12
  759. drivers/staging/pi433/pi433_if.c +25 −42
  760. drivers/staging/pi433/rf69.c +132 −104
  761. drivers/staging/rtl8188eu/core/rtw_ap.c +1 −1
  762. drivers/staging/rtl8188eu/core/rtw_cmd.c +2 −2
  763. drivers/staging/rtl8188eu/core/rtw_efuse.c +1 −1
  764. drivers/staging/rtl8188eu/core/rtw_led.c +3 −4
  765. drivers/staging/rtl8188eu/core/rtw_mlme.c +26 −23
  766. drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +54 −35
  767. drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +18 −17
  768. drivers/staging/rtl8188eu/core/rtw_recv.c +85 −59
  769. drivers/staging/rtl8188eu/core/rtw_security.c +1 −1
  770. drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +2 −2
  771. drivers/staging/rtl8188eu/core/rtw_xmit.c +32 −32
  772. drivers/staging/rtl8188eu/hal/odm.c +1 −1
  773. drivers/staging/rtl8188eu/hal/odm_HWConfig.c +2 −2
  774. drivers/staging/rtl8188eu/hal/phy.c +7 −8
  775. drivers/staging/rtl8188eu/hal/usb_halinit.c +1 −0
  776. drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h +22 −11
  777. drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h +2 −1
  778. drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h +14 −14
  779. drivers/staging/rtl8188eu/include/basic_types.h +8 −6
  780. drivers/staging/rtl8188eu/include/drv_types.h +2 −1
  781. drivers/staging/rtl8188eu/include/hal_intf.h +4 −2
  782. drivers/staging/rtl8188eu/include/ieee80211.h +59 −55
  783. drivers/staging/rtl8188eu/include/odm.h +29 −17
  784. drivers/staging/rtl8188eu/include/osdep_intf.h +1 −1
  785. drivers/staging/rtl8188eu/include/pwrseq.h +22 −22
  786. drivers/staging/rtl8188eu/include/rtl8188e_hal.h +18 −11
  787. drivers/staging/rtl8188eu/include/rtl8188e_spec.h +85 −72
  788. drivers/staging/rtl8188eu/include/rtw_cmd.h +113 −109
  789. drivers/staging/rtl8188eu/include/rtw_debug.h +2 −2
  790. drivers/staging/rtl8188eu/include/rtw_eeprom.h +6 −3
  791. drivers/staging/rtl8188eu/include/rtw_event.h +20 −20
  792. drivers/staging/rtl8188eu/include/rtw_led.h +4 −3
  793. drivers/staging/rtl8188eu/include/rtw_mlme.h +25 −19
  794. drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +21 −12
  795. drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h +13 −6
  796. drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +13 −9
  797. drivers/staging/rtl8188eu/include/rtw_qos.h +2 −1
  798. drivers/staging/rtl8188eu/include/rtw_recv.h +42 −40
  799. drivers/staging/rtl8188eu/include/rtw_rf.h +4 −2
  800. drivers/staging/rtl8188eu/include/rtw_security.h +18 −9
  801. drivers/staging/rtl8188eu/include/rtw_xmit.h +8 −4
  802. drivers/staging/rtl8188eu/include/sta_info.h +8 −4
  803. drivers/staging/rtl8188eu/include/wifi.h +14 −11
  804. drivers/staging/rtl8188eu/include/wlan_bssdef.h +14 −8
  805. drivers/staging/rtl8188eu/os_dep/mlme_linux.c +7 −12
  806. drivers/staging/rtl8188eu/os_dep/mon.c +5 −29
  807. drivers/staging/rtl8188eu/os_dep/recv_linux.c +2 −3
  808. drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +1 −0
  809. drivers/staging/rtl8192e/dot11d.c +6 −2
  810. drivers/staging/rtl8192e/rtl8192e/rtl_core.c +11 −14
  811. drivers/staging/rtl8192e/rtl8192e/rtl_core.h +1 −1
  812. drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +5 −6
  813. drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +1 −1
  814. drivers/staging/rtl8192e/rtl819x_BAProc.c +9 −6
  815. drivers/staging/rtl8192e/rtl819x_TSProc.c +23 −33
  816. drivers/staging/rtl8192e/rtllib.h +3 −3
  817. drivers/staging/rtl8192e/rtllib_softmac.c +11 −12
  818. drivers/staging/rtl8192e/rtllib_wx.c +1 −2
  819. drivers/staging/rtl8192u/ieee80211/ieee80211.h +58 −60
  820. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +2 −2
  821. drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h +1 −1
  822. drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +2 −2
  823. drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +13 −14
  824. drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +0 −1
  825. drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +4 −11
  826. drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +8 −8
  827. drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +22 −24
  828. drivers/staging/rtl8192u/r8192U_core.c +10 −10
  829. drivers/staging/rtl8192u/r8192U_dm.c +4 −5
  830. drivers/staging/rtl8192u/r8192U_dm.h +1 −1
  831. drivers/staging/rtl8192u/r8192U_wx.c +1 −1
  832. drivers/staging/rtl8192u/r8192U_wx.h +1 −1
  833. drivers/staging/rtl8712/hal_init.c +2 −2
  834. drivers/staging/rtl8712/mlme_linux.c +24 −24
  835. drivers/staging/rtl8712/os_intfs.c +4 −4
  836. drivers/staging/rtl8712/rtl8712_cmd.c +2 −2
  837. drivers/staging/rtl8712/rtl8712_event.h +0 −1
  838. drivers/staging/rtl8712/rtl8712_recv.c +3 −3
  839. drivers/staging/rtl8712/rtl871x_cmd.c +2 −1
  840. drivers/staging/rtl8712/rtl871x_ioctl_set.c +2 −2
  841. drivers/staging/rtl8712/rtl871x_mlme.c +2 −2
  842. drivers/staging/rtl8712/rtl871x_pwrctrl.c +4 −4
  843. drivers/staging/rtl8712/rtl871x_security.c +3 −2
  844. drivers/staging/rtl8712/rtl871x_security.h +1 −1
  845. drivers/staging/rtl8712/usb_intf.c +2 −1
  846. drivers/staging/rtl8723bs/core/rtw_ap.c +4 −6
  847. drivers/staging/rtl8723bs/core/rtw_btcoex.c +2 −2
  848. drivers/staging/rtl8723bs/core/rtw_cmd.c +72 −72
  849. drivers/staging/rtl8723bs/core/rtw_debug.c +5 −3
  850. drivers/staging/rtl8723bs/core/rtw_ieee80211.c +3 −3
  851. drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +0 −4
  852. drivers/staging/rtl8723bs/core/rtw_mlme.c +11 −10
  853. drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +75 −65
  854. drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +16 −18
  855. drivers/staging/rtl8723bs/core/rtw_recv.c +16 −17
  856. drivers/staging/rtl8723bs/core/rtw_rf.c +3 −4
  857. drivers/staging/rtl8723bs/core/rtw_security.c +1 −1
  858. drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +5 −5
  859. drivers/staging/rtl8723bs/core/rtw_wlan_util.c +2 −2
  860. drivers/staging/rtl8723bs/core/rtw_xmit.c +1 −4
  861. drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +4 −5
  862. drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +2 −2
  863. drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +3 −4
  864. drivers/staging/rtl8723bs/hal/hal_btcoex.c +2 −9
  865. drivers/staging/rtl8723bs/hal/hal_com.c +5 −5
  866. drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +45 −24
  867. drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +1 −1
  868. drivers/staging/rtl8723bs/hal/odm_DIG.c +1 −1
  869. drivers/staging/rtl8723bs/hal/odm_HWConfig.c +1 −1
  870. drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +1 −1
  871. drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +1 −1
  872. drivers/staging/rtl8723bs/hal/sdio_halinit.c +2 −2
  873. drivers/staging/rtl8723bs/hal/sdio_ops.c +5 −5
  874. drivers/staging/rtl8723bs/include/drv_types.h +2 −1
  875. drivers/staging/rtl8723bs/include/osdep_service.h +2 −4
  876. drivers/staging/rtl8723bs/include/osdep_service_linux.h +1 −12
  877. drivers/staging/rtl8723bs/include/rtw_mlme.h +5 −5
  878. drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +5 −5
  879. drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +2 −1
  880. drivers/staging/rtl8723bs/include/rtw_recv.h +1 −1
  881. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +7 −9
  882. drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +17 −28
  883. drivers/staging/rtl8723bs/os_dep/mlme_linux.c +32 −30
  884. drivers/staging/rtl8723bs/os_dep/os_intfs.c +104 −139
  885. drivers/staging/rtl8723bs/os_dep/osdep_service.c +6 −18
  886. drivers/staging/rtl8723bs/os_dep/recv_linux.c +2 −3
  887. drivers/staging/rtl8723bs/os_dep/rtw_proc.c +3 −3
  888. drivers/staging/rtlwifi/base.c +28 −30
  889. drivers/staging/rtlwifi/base.h +2 −2
  890. drivers/staging/rtlwifi/core.c +18 −54
  891. drivers/staging/rtlwifi/core.h +0 −4
  892. drivers/staging/rtlwifi/debug.c +18 −18
  893. drivers/staging/rtlwifi/efuse.c +2 −3
  894. drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c +2 −0
  895. drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c +14 −36
  896. drivers/staging/rtlwifi/halmac/rtl_halmac.c +1 −1
  897. drivers/staging/rtlwifi/pci.c +1 −1
  898. drivers/staging/rtlwifi/phydm/halphyrf_ce.c +1 −1
  899. drivers/staging/rtlwifi/phydm/phydm.c +4 −4
  900. drivers/staging/rtlwifi/phydm/phydm_adaptivity.c +2 −2
  901. drivers/staging/rtlwifi/phydm/phydm_debug.c +6 −6
  902. drivers/staging/rtlwifi/phydm/phydm_dig.c +13 −11
  903. drivers/staging/rtlwifi/phydm/phydm_interface.c +0 −23
  904. drivers/staging/rtlwifi/phydm/phydm_interface.h +0 −11
  905. drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_bb.c +4 −6
  906. drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_mac.c +2 −2
  907. drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_rf.c +5 −8
  908. drivers/staging/rtlwifi/ps.c +1 −1
  909. drivers/staging/rtlwifi/rc.c +7 −9
  910. drivers/staging/rtlwifi/rtl8822be/fw.c +5 −4
  911. drivers/staging/rtlwifi/rtl8822be/led.c +1 −1
  912. drivers/staging/rtlwifi/rtl8822be/phy.c +12 −11
  913. drivers/staging/rtlwifi/rtl8822be/trx.c +12 −12
  914. drivers/staging/rts5208/sd.c +0 −6
  915. drivers/staging/sm750fb/ddk750_chip.h +1 −1
  916. drivers/staging/sm750fb/ddk750_dvi.c +2 −2
  917. drivers/staging/sm750fb/ddk750_dvi.h +2 −2
  918. drivers/staging/sm750fb/ddk750_power.c +1 −1
  919. drivers/staging/sm750fb/ddk750_power.h +3 −4
  920. drivers/staging/sm750fb/ddk750_sii164.c +2 −1
  921. drivers/staging/sm750fb/ddk750_sii164.h +2 −2
  922. drivers/staging/sm750fb/sm750_cursor.c +0 −4
  923. drivers/staging/speakup/buffers.c +2 −2
  924. drivers/staging/speakup/main.c +2 −2
  925. drivers/staging/speakup/speakup_acntsa.c +1 −1
  926. drivers/staging/speakup/speakup_apollo.c +1 −1
  927. drivers/staging/speakup/speakup_audptr.c +1 −1
  928. drivers/staging/speakup/speakup_bns.c +1 −1
  929. drivers/staging/speakup/speakup_decext.c +1 −1
  930. drivers/staging/speakup/speakup_dectlk.c +1 −1
  931. drivers/staging/speakup/speakup_dummy.c +1 −1
  932. drivers/staging/speakup/speakup_ltlk.c +1 −1
  933. drivers/staging/speakup/speakup_spkout.c +1 −1
  934. drivers/staging/speakup/speakup_txprt.c +1 −1
  935. drivers/staging/speakup/spk_ttyio.c +5 −5
  936. drivers/staging/typec/Kconfig +0 −10
  937. drivers/staging/typec/Makefile +0 −2
  938. drivers/staging/typec/TODO +0 −10
  939. drivers/staging/typec/fusb302/TODO +0 −10
  940. drivers/staging/typec/tcpci.c +3 −2
  941. drivers/staging/unisys/MAINTAINERS +1 −1
  942. drivers/staging/unisys/include/iochannel.h +4 −5
  943. drivers/staging/unisys/include/visorbus.h +67 −92
  944. drivers/staging/unisys/include/visorchannel.h +4 −8
  945. drivers/staging/unisys/visorbus/controlvmchannel.h +2 −1
  946. drivers/staging/unisys/visorbus/vbuschannel.h +5 −7
  947. drivers/staging/unisys/visorbus/visorbus_main.c +126 −145
  948. drivers/staging/unisys/visorbus/visorbus_private.h +3 −5
  949. drivers/staging/unisys/visorbus/visorchannel.c +21 −60
  950. drivers/staging/unisys/visorbus/visorchipset.c +69 −229
  951. drivers/staging/unisys/visorhba/visorhba_main.c +7 −5
  952. drivers/staging/unisys/visorinput/visorinput.c +4 −2
  953. drivers/staging/unisys/visornic/visornic_main.c +6 −4
  954. drivers/staging/vboxvideo/vbox_drv.h +4 −4
  955. drivers/staging/vboxvideo/vbox_irq.c +2 −2
  956. drivers/staging/vboxvideo/vbox_mode.c +18 −8
  957. drivers/staging/vc04_services/Kconfig +0 −12
  958. drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +0 −11
  959. drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +0 −11
  960. drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +0 −2
  961. drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h +12 −12
  962. drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +1 −1
  963. drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +1 −1
  964. drivers/staging/vc04_services/interface/vchi/connections/connection.h +0 −3
  965. drivers/staging/vc04_services/interface/vchi/message_drivers/message.h +0 −5
  966. drivers/staging/vc04_services/interface/vchi/vchi.h +1 −11
  967. drivers/staging/vc04_services/interface/vchi/vchi_common.h +0 −6
  968. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +30 −27
  969. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +7 −170
  970. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +1 −5
  971. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +1 −12
  972. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +0 −1
  973. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +0 −3
  974. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +22 −25
  975. drivers/staging/vme/devices/Kconfig +0 −13
  976. drivers/staging/vme/devices/Makefile +0 −3
  977. drivers/staging/vme/devices/vme_pio2.h +0 −245
  978. drivers/staging/vme/devices/vme_pio2_cntr.c +0 −71
  979. drivers/staging/vme/devices/vme_pio2_core.c +0 −493
  980. drivers/staging/vme/devices/vme_pio2_gpio.c +0 −220
  981. drivers/staging/vt6655/device_main.c +2 −1
  982. drivers/staging/vt6655/key.c +3 −1
  983. drivers/staging/vt6656/card.c +2 −0
  984. drivers/staging/wilc1000/host_interface.c +25 −20
  985. drivers/staging/wilc1000/host_interface.h +5 −0
  986. drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1 −2
  987. drivers/staging/wilc1000/wilc_wlan.c +1 −1
  988. drivers/staging/wlan-ng/hfa384x_usb.c +13 −16
  989. drivers/staging/wlan-ng/prism2mgmt.c +47 −31
  990. drivers/staging/wlan-ng/prism2mgmt.h +1 −1
  991. drivers/staging/wlan-ng/prism2sta.c +3 −3
  992. drivers/staging/xgifb/XGI_main_26.c +2 −2
  993. drivers/staging/xgifb/vb_setmode.c +4 −3
  994. drivers/usb/typec/Kconfig +14 −0
  995. drivers/usb/typec/Makefile +2 −0
  996. drivers/usb/typec/fusb302/Kconfig +0 −0
  997. drivers/usb/typec/fusb302/Makefile +0 −0
  998. drivers/usb/typec/fusb302/fusb302.c +2 −2
  999. drivers/usb/typec/fusb302/fusb302_reg.h +0 −0
  1000. drivers/usb/typec/tcpm.c +5 −41
  1001. include/linux/hid-sensor-hub.h +1 −0
  1002. include/linux/iio/common/st_sensors.h +23 −12
  1003. include/linux/iio/iio.h +29 −6
  1004. include/linux/iio/trigger.h +13 −8
  1005. include/linux/usb/pd.h +5 −0
  1006. include/linux/usb/pd_bdo.h +0 −0
  1007. include/linux/usb/pd_vdo.h +0 −0
  1008. include/linux/usb/tcpm.h +50 −7
Documentation/ABI/testing/sysfs-bus-iio+4−3
@@ -522,6 +522,7 @@ Description: · 521 unmodified lines
522522 Specifies the output powerdown mode.
523523 DAC output stage is disconnected from the amplifier and
524524 1kohm_to_gnd: connected to ground via an 1kOhm resistor,
525+ 2.5kohm_to_gnd: connected to ground via a 2.5kOhm resistor,
525526 6kohm_to_gnd: connected to ground via a 6kOhm resistor,
526527 20kohm_to_gnd: connected to ground via a 20kOhm resistor,
527528 90kohm_to_gnd: connected to ground via a 90kOhm resistor,
@@ -1242,9 +1243,9 @@ What: /sys/.../iio:deviceX/in_distance_raw · 714 unmodified lines
12421243 KernelVersion: 4.0
12431244 Contact: linux-iio@vger.kernel.org
12441245 Description:
1245− This attribute is used to read the distance covered by the user
1246− since the last reboot while activated. Units after application
1247− of scale are meters.
1246+ This attribute is used to read the measured distance to an object
1247+ or the distance covered by the user since the last reboot while
1248+ activated. Units after application of scale are meters.
12481249
12491250 What: /sys/bus/iio/devices/iio:deviceX/store_eeprom
12501251 KernelVersion: 3.4.0
Documentation/ABI/testing/sysfs-bus-iio-cros-ec+10−0
@@ -16,3 +16,13 @@ Description: · 15 unmodified lines
1616 the motion sensor is placed. For example, in a laptop a motion
1717 sensor can be located on the base or on the lid. Current valid
1818 values are 'base' and 'lid'.
19+
20+What: /sys/bus/iio/devices/iio:deviceX/id
21+Date: Septembre 2017
22+KernelVersion: 4.14
23+Contact: linux-iio@vger.kernel.org
24+Description:
25+ This attribute is exposed by the CrOS EC legacy accelerometer
26+ driver and represents the sensor ID as exposed by the EC. This
27+ ID is used by the Android sensor service hardware abstraction
28+ layer (sensor HAL) through the Android container on ChromeOS.
Documentation/devicetree/bindings/iio/adc/mcp320x.txt+14−0
@@ -29,15 +29,29 @@ Required properties: · 28 unmodified lines
2929 "microchip,mcp3204"
3030 "microchip,mcp3208"
3131 "microchip,mcp3301"
32+ "microchip,mcp3550-50"
33+ "microchip,mcp3550-60"
34+ "microchip,mcp3551"
35+ "microchip,mcp3553"
3236
3337 NOTE: The use of the compatibles with no vendor prefix
3438 is deprecated and only listed because old DT use them.
3539
40+ - spi-cpha, spi-cpol (boolean):
41+ Either SPI mode (0,0) or (1,1) must be used, so specify
42+ none or both of spi-cpha, spi-cpol. The MCP3550/1/3
43+ is more efficient in mode (1,1) as only 3 instead of
44+ 4 bytes need to be read from the ADC, but not all SPI
45+ masters support it.
46+
47+ - vref-supply: Phandle to the external reference voltage supply.
48+
3649 Examples:
3750 spi_controller {
3851 mcp3x0x@0 {
3952 compatible = "mcp3002";
4053 reg = <0>;
4154 spi-max-frequency = <1000000>;
55+ vref-supply = <&vref_reg>;
4256 };
4357 };
Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt+1−0
@@ -12,6 +12,7 @@ for the Thermal Controller which holds a phandle to the AUXADC. · 11 unmodified lines
1212 Required properties:
1313 - compatible: Should be one of:
1414 - "mediatek,mt2701-auxadc": For MT2701 family of SoCs
15+ - "mediatek,mt2712-auxadc": For MT2712 family of SoCs
1516 - "mediatek,mt7622-auxadc": For MT7622 family of SoCs
1617 - "mediatek,mt8173-auxadc": For MT8173 family of SoCs
1718 - reg: Address range of the AUXADC unit.
Documentation/devicetree/bindings/iio/dac/ds4424.txt+20−0
@@ -0,0 +1,20 @@
1+Maxim Integrated DS4422/DS4424 7-bit Sink/Source Current DAC Device Driver
2+
3+Datasheet publicly available at:
4+https://datasheets.maximintegrated.com/en/ds/DS4422-DS4424.pdf
5+
6+Required properties:
7+ - compatible: Should be one of
8+ maxim,ds4422
9+ maxim,ds4424
10+ - reg: Should contain the DAC I2C address
11+
12+Optional properties:
13+ - vcc-supply: Power supply is optional. If not defined, driver will ignore it.
14+
15+Example:
16+ ds4224@10 {
17+ compatible = "maxim,ds4424";
18+ reg = <0x10>; /* When A0, A1 pins are ground */
19+ vcc-supply = <&vcc_3v3>;
20+ };
Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt+34−0
@@ -0,0 +1,34 @@
1+Texas Instruments 8/10/12-bit 2/4-channel DAC driver
2+
3+Required properties:
4+ - compatible: Must be one of:
5+ "ti,dac082s085"
6+ "ti,dac102s085"
7+ "ti,dac122s085"
8+ "ti,dac084s085"
9+ "ti,dac104s085"
10+ "ti,dac124s085"
11+ - reg: Chip select number.
12+ - spi-cpha, spi-cpol: SPI mode (0,1) or (1,0) must be used, so specify
13+ either spi-cpha or spi-cpol (but not both).
14+ - vref-supply: Phandle to the external reference voltage supply.
15+
16+For other required and optional properties of SPI slave nodes please refer to
17+../../spi/spi-bus.txt.
18+
19+Example:
20+ vref_2v5_reg: regulator-vref {
21+ compatible = "regulator-fixed";
22+ regulator-name = "2v5";
23+ regulator-min-microvolt = <2500000>;
24+ regulator-max-microvolt = <2500000>;
25+ regulator-always-on;
26+ };
27+
28+ dac@0 {
29+ compatible = "ti,dac082s085";
30+ reg = <0>;
31+ spi-max-frequency = <40000000>;
32+ spi-cpol;
33+ vref-supply = <&vref_2v5_reg>;
34+ };
Documentation/devicetree/bindings/iio/health/max30100.txt+2−2
@@ -20,9 +20,9 @@ Optional properties: · 19 unmodified lines
2020
2121 Example:
2222
23−max30100@057 {
23+max30100@57 {
2424 compatible = "maxim,max30100";
25− reg = <57>;
25+ reg = <0x57>;
2626 maxim,led-current-microamp = <24000 50000>;
2727 interrupt-parent = <&gpio1>;
2828 interrupts = <16 2>;
Documentation/devicetree/bindings/iio/health/max30102.txt+1−1
@@ -20,7 +20,7 @@ Optional properties: · 19 unmodified lines
2020
2121 Example:
2222
23−max30100@57 {
23+max30102@57 {
2424 compatible = "maxim,max30102";
2525 reg = <0x57>;
2626 maxim,red-led-current-microamp = <7000>;
Documentation/devicetree/bindings/iio/st-sensors.txt+4−0
@@ -46,6 +46,8 @@ Accelerometers: · 45 unmodified lines
4646 - st,h3lis331dl-accel
4747 - st,lng2dm-accel
4848 - st,lis3l02dq
49+- st,lis2dw12
50+- st,lis3dhh
4951
5052 Gyroscopes:
5153 - st,l3g4200d-gyro
@@ -71,3 +73,5 @@ Pressure sensors: · 19 unmodified lines
7173 - st,lps25h-press
7274 - st,lps331ap-press
7375 - st,lps22hb-press
76+- st,lps33hw
77+- st,lps35hw
arch/arm/configs/pxa_defconfig+2−1
@@ -219,7 +219,8 @@ CONFIG_AD525X_DPOT_I2C=m · 218 unmodified lines
219219 CONFIG_ICS932S401=m
220220 CONFIG_APDS9802ALS=m
221221 CONFIG_ISL29003=m
222−CONFIG_TI_DAC7512=m
222+CONFIG_IIO=m
223+CONFIG_AD5446=m
223224 CONFIG_EEPROM_AT24=m
224225 CONFIG_SENSORS_LIS3_SPI=m
225226 CONFIG_IDE=m
arch/arm/configs/raumfeld_defconfig+2−1
@@ -37,7 +37,8 @@ CONFIG_MTD_NAND_PXA3xx=y · 36 unmodified lines
3737 CONFIG_MTD_UBI=y
3838 CONFIG_BLK_DEV_LOOP=y
3939 CONFIG_ISL29003=y
40−CONFIG_TI_DAC7512=y
40+CONFIG_IIO=y
41+CONFIG_AD5446=y
4142 CONFIG_SCSI=y
4243 CONFIG_BLK_DEV_SD=y
4344 CONFIG_CHR_DEV_SG=y
drivers/iio/accel/Kconfig+13−2
@@ -148,6 +148,17 @@ config HID_SENSOR_ACCEL_3D · 147 unmodified lines
148148 To compile this driver as a module, choose M here: the
149149 module will be called hid-sensor-accel-3d.
150150
151+config IIO_CROS_EC_ACCEL_LEGACY
152+ tristate "ChromeOS EC Legacy Accelerometer Sensor"
153+ select IIO_BUFFER
154+ select IIO_TRIGGERED_BUFFER
155+ select CROS_EC_LPC_REGISTER_DEVICE
156+ help
157+ Say yes here to get support for accelerometers on Chromebook using
158+ legacy EC firmware.
159+ Sensor data is retrieved through IO memory.
160+ Newer devices should use IIO_CROS_EC_SENSORS.
161+
151162 config IIO_ST_ACCEL_3AXIS
152163 tristate "STMicroelectronics accelerometers 3-Axis Driver"
153164 depends on (I2C || SPI_MASTER) && SYSFS
@@ -219,8 +230,8 @@ config KXCJK1013 · 65 unmodified lines
219230 select IIO_TRIGGERED_BUFFER
220231 help
221232 Say Y here if you want to build a driver for the Kionix KXCJK-1013
222− triaxial acceleration sensor. This driver also supports KXCJ9-1008
223− and KXTJ2-1009.
233+ triaxial acceleration sensor. This driver also supports KXCJ9-1008,
234+ KXTJ2-1009 and KXTF9.
224235
225236 To compile this driver as a module, choose M here: the module will
226237 be called kxcjk-1013.
drivers/iio/accel/Makefile+2−0
@@ -44,6 +44,8 @@ obj-$(CONFIG_SCA3000) += sca3000.o · 43 unmodified lines
4444 obj-$(CONFIG_STK8312) += stk8312.o
4545 obj-$(CONFIG_STK8BA50) += stk8ba50.o
4646
47+obj-$(CONFIG_IIO_CROS_EC_ACCEL_LEGACY) += cros_ec_accel_legacy.o
48+
4749 obj-$(CONFIG_IIO_SSP_SENSORS_COMMONS) += ssp_accel_sensor.o
4850
4951 obj-$(CONFIG_IIO_ST_ACCEL_3AXIS) += st_accel.o
drivers/iio/accel/adxl345_core.c+0−1
@@ -95,7 +95,6 @@ static int adxl345_read_raw(struct iio_dev *indio_dev, · 94 unmodified lines
9595 }
9696
9797 static const struct iio_info adxl345_info = {
98− .driver_module = THIS_MODULE,
9998 .read_raw = adxl345_read_raw,
10099 };
101100
drivers/iio/accel/bma180.c+0−2
@@ -536,7 +536,6 @@ static const struct iio_info bma180_info = { · 535 unmodified lines
536536 .attrs = &bma180_attrs_group,
537537 .read_raw = bma180_read_raw,
538538 .write_raw = bma180_write_raw,
539− .driver_module = THIS_MODULE,
540539 };
541540
542541 static const char * const bma180_power_modes[] = { "low_noise", "low_power" };
@@ -700,7 +699,6 @@ static int bma180_trig_try_reen(struct iio_trigger *trig) · 157 unmodified lines
700699 static const struct iio_trigger_ops bma180_trigger_ops = {
701700 .set_trigger_state = bma180_data_rdy_trigger_set_state,
702701 .try_reenable = bma180_trig_try_reen,
703− .owner = THIS_MODULE,
704702 };
705703
706704 static int bma180_probe(struct i2c_client *client,
drivers/iio/accel/bma220_spi.c+0−1
@@ -186,7 +186,6 @@ static int bma220_write_raw(struct iio_dev *indio_dev, · 185 unmodified lines
186186 }
187187
188188 static const struct iio_info bma220_info = {
189− .driver_module = THIS_MODULE,
190189 .read_raw = bma220_read_raw,
191190 .write_raw = bma220_write_raw,
192191 .attrs = &bma220_attribute_group,
drivers/iio/accel/bmc150-accel-core.c+0−3
@@ -1094,7 +1094,6 @@ static const struct iio_info bmc150_accel_info = { · 1093 unmodified lines
10941094 .write_event_value = bmc150_accel_write_event,
10951095 .write_event_config = bmc150_accel_write_event_config,
10961096 .read_event_config = bmc150_accel_read_event_config,
1097− .driver_module = THIS_MODULE,
10981097 };
10991098
11001099 static const struct iio_info bmc150_accel_info_fifo = {
@@ -1108,7 +1107,6 @@ static const struct iio_info bmc150_accel_info_fifo = { · 7 unmodified lines
11081107 .validate_trigger = bmc150_accel_validate_trigger,
11091108 .hwfifo_set_watermark = bmc150_accel_set_watermark,
11101109 .hwfifo_flush_to_buffer = bmc150_accel_fifo_flush,
1111− .driver_module = THIS_MODULE,
11121110 };
11131111
11141112 static const unsigned long bmc150_accel_scan_masks[] = {
@@ -1200,7 +1198,6 @@ static int bmc150_accel_trigger_set_state(struct iio_trigger *trig, · 85 unmodified lines
12001198 static const struct iio_trigger_ops bmc150_accel_trigger_ops = {
12011199 .set_trigger_state = bmc150_accel_trigger_set_state,
12021200 .try_reenable = bmc150_accel_trig_try_reen,
1203− .owner = THIS_MODULE,
12041201 };
12051202
12061203 static int bmc150_accel_handle_roc_event(struct iio_dev *indio_dev)
drivers/iio/accel/cros_ec_accel_legacy.c+423−0
@@ -0,0 +1,423 @@
1+/*
2+ * Driver for older Chrome OS EC accelerometer
3+ *
4+ * Copyright 2017 Google, Inc
5+ *
6+ * This software is licensed under the terms of the GNU General Public
7+ * License version 2, as published by the Free Software Foundation, and
8+ * may be copied, distributed, and modified under those terms.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * This driver uses the memory mapper cros-ec interface to communicate
16+ * with the Chrome OS EC about accelerometer data.
17+ * Accelerometer access is presented through iio sysfs.
18+ */
19+
20+#include <linux/delay.h>
21+#include <linux/device.h>
22+#include <linux/iio/buffer.h>
23+#include <linux/iio/iio.h>
24+#include <linux/iio/kfifo_buf.h>
25+#include <linux/iio/trigger_consumer.h>
26+#include <linux/iio/triggered_buffer.h>
27+#include <linux/kernel.h>
28+#include <linux/mfd/cros_ec.h>
29+#include <linux/mfd/cros_ec_commands.h>
30+#include <linux/module.h>
31+#include <linux/slab.h>
32+#include <linux/sysfs.h>
33+#include <linux/platform_device.h>
34+
35+#define DRV_NAME "cros-ec-accel-legacy"
36+
37+/*
38+ * Sensor scale hard coded at 10 bits per g, computed as:
39+ * g / (2^10 - 1) = 0.009586168; with g = 9.80665 m.s^-2
40+ */
41+#define ACCEL_LEGACY_NSCALE 9586168
42+
43+/* Indices for EC sensor values. */
44+enum {
45+ X,
46+ Y,
47+ Z,
48+ MAX_AXIS,
49+};
50+
51+/* State data for cros_ec_accel_legacy iio driver. */
52+struct cros_ec_accel_legacy_state {
53+ struct cros_ec_device *ec;
54+
55+ /*
56+ * Array holding data from a single capture. 2 bytes per channel
57+ * for the 3 channels plus the timestamp which is always last and
58+ * 8-bytes aligned.
59+ */
60+ s16 capture_data[8];
61+ s8 sign[MAX_AXIS];
62+ u8 sensor_num;
63+};
64+
65+static int ec_cmd_read_u8(struct cros_ec_device *ec, unsigned int offset,
66+ u8 *dest)
67+{
68+ return ec->cmd_readmem(ec, offset, 1, dest);
69+}
70+
71+static int ec_cmd_read_u16(struct cros_ec_device *ec, unsigned int offset,
72+ u16 *dest)
73+{
74+ __le16 tmp;
75+ int ret = ec->cmd_readmem(ec, offset, 2, &tmp);
76+
77+ *dest = le16_to_cpu(tmp);
78+
79+ return ret;
80+}
81+
82+/**
83+ * read_ec_until_not_busy() - Read from EC status byte until it reads not busy.
84+ * @st: Pointer to state information for device.
85+ *
86+ * This function reads EC status until its busy bit gets cleared. It does not
87+ * wait indefinitely and returns -EIO if the EC status is still busy after a
88+ * few hundreds milliseconds.
89+ *
90+ * Return: 8-bit status if ok, -EIO on error
91+ */
92+static int read_ec_until_not_busy(struct cros_ec_accel_legacy_state *st)
93+{
94+ struct cros_ec_device *ec = st->ec;
95+ u8 status;
96+ int attempts = 0;
97+
98+ ec_cmd_read_u8(ec, EC_MEMMAP_ACC_STATUS, &status);
99+ while (status & EC_MEMMAP_ACC_STATUS_BUSY_BIT) {
100+ /* Give up after enough attempts, return error. */
101+ if (attempts++ >= 50)
102+ return -EIO;
103+
104+ /* Small delay every so often. */
105+ if (attempts % 5 == 0)
106+ msleep(25);
107+
108+ ec_cmd_read_u8(ec, EC_MEMMAP_ACC_STATUS, &status);
109+ }
110+
111+ return status;
112+}
113+
114+/**
115+ * read_ec_accel_data_unsafe() - Read acceleration data from EC shared memory.
116+ * @st: Pointer to state information for device.
117+ * @scan_mask: Bitmap of the sensor indices to scan.
118+ * @data: Location to store data.
119+ *
120+ * This is the unsafe function for reading the EC data. It does not guarantee
121+ * that the EC will not modify the data as it is being read in.
122+ */
123+static void read_ec_accel_data_unsafe(struct cros_ec_accel_legacy_state *st,
124+ unsigned long scan_mask, s16 *data)
125+{
126+ int i = 0;
127+ int num_enabled = bitmap_weight(&scan_mask, MAX_AXIS);
128+
129+ /* Read all sensors enabled in scan_mask. Each value is 2 bytes. */
130+ while (num_enabled--) {
131+ i = find_next_bit(&scan_mask, MAX_AXIS, i);
132+ ec_cmd_read_u16(st->ec,
133+ EC_MEMMAP_ACC_DATA +
134+ sizeof(s16) *
135+ (1 + i + st->sensor_num * MAX_AXIS),
136+ data);
137+ *data *= st->sign[i];
138+ i++;
139+ data++;
140+ }
141+}
142+
143+/**
144+ * read_ec_accel_data() - Read acceleration data from EC shared memory.
145+ * @st: Pointer to state information for device.
146+ * @scan_mask: Bitmap of the sensor indices to scan.
147+ * @data: Location to store data.
148+ *
149+ * This is the safe function for reading the EC data. It guarantees that
150+ * the data sampled was not modified by the EC while being read.
151+ *
152+ * Return: 0 if ok, -ve on error
153+ */
154+static int read_ec_accel_data(struct cros_ec_accel_legacy_state *st,
155+ unsigned long scan_mask, s16 *data)
156+{
157+ u8 samp_id = 0xff;
158+ u8 status = 0;
159+ int ret;
160+ int attempts = 0;
161+
162+ /*
163+ * Continually read all data from EC until the status byte after
164+ * all reads reflects that the EC is not busy and the sample id
165+ * matches the sample id from before all reads. This guarantees
166+ * that data read in was not modified by the EC while reading.
167+ */
168+ while ((status & (EC_MEMMAP_ACC_STATUS_BUSY_BIT |
169+ EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK)) != samp_id) {
170+ /* If we have tried to read too many times, return error. */
171+ if (attempts++ >= 5)
172+ return -EIO;
173+
174+ /* Read status byte until EC is not busy. */
175+ ret = read_ec_until_not_busy(st);
176+ if (ret < 0)
177+ return ret;
178+ status = ret;
179+
180+ /*
181+ * Store the current sample id so that we can compare to the
182+ * sample id after reading the data.
183+ */
184+ samp_id = status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK;
185+
186+ /* Read all EC data, format it, and store it into data. */
187+ read_ec_accel_data_unsafe(st, scan_mask, data);
188+
189+ /* Read status byte. */
190+ ec_cmd_read_u8(st->ec, EC_MEMMAP_ACC_STATUS, &status);
191+ }
192+
193+ return 0;
194+}
195+
196+static int cros_ec_accel_legacy_read(struct iio_dev *indio_dev,
197+ struct iio_chan_spec const *chan,
198+ int *val, int *val2, long mask)
199+{
200+ struct cros_ec_accel_legacy_state *st = iio_priv(indio_dev);
201+ s16 data = 0;
202+ int ret = IIO_VAL_INT;
203+
204+ switch (mask) {
205+ case IIO_CHAN_INFO_RAW:
206+ ret = read_ec_accel_data(st, (1 << chan->scan_index), &data);
207+ if (ret)
208+ return ret;
209+ *val = data;
210+ return IIO_VAL_INT;
211+ case IIO_CHAN_INFO_SCALE:
212+ *val = 0;
213+ *val2 = ACCEL_LEGACY_NSCALE;
214+ return IIO_VAL_INT_PLUS_NANO;
215+ case IIO_CHAN_INFO_CALIBBIAS:
216+ /* Calibration not supported. */
217+ *val = 0;
218+ return IIO_VAL_INT;
219+ default:
220+ return -EINVAL;
221+ }
222+}
223+
224+static int cros_ec_accel_legacy_write(struct iio_dev *indio_dev,
225+ struct iio_chan_spec const *chan,
226+ int val, int val2, long mask)
227+{
228+ /*
229+ * Do nothing but don't return an error code to allow calibration
230+ * script to work.
231+ */
232+ if (mask == IIO_CHAN_INFO_CALIBBIAS)
233+ return 0;
234+
235+ return -EINVAL;
236+}
237+
238+static const struct iio_info cros_ec_accel_legacy_info = {
239+ .read_raw = &cros_ec_accel_legacy_read,
240+ .write_raw = &cros_ec_accel_legacy_write,
241+};
242+
243+/**
244+ * cros_ec_accel_legacy_capture() - The trigger handler function
245+ * @irq: The interrupt number.
246+ * @p: Private data - always a pointer to the poll func.
247+ *
248+ * On a trigger event occurring, if the pollfunc is attached then this
249+ * handler is called as a threaded interrupt (and hence may sleep). It
250+ * is responsible for grabbing data from the device and pushing it into
251+ * the associated buffer.
252+ *
253+ * Return: IRQ_HANDLED
254+ */
255+static irqreturn_t cros_ec_accel_legacy_capture(int irq, void *p)
256+{
257+ struct iio_poll_func *pf = p;
258+ struct iio_dev *indio_dev = pf->indio_dev;
259+ struct cros_ec_accel_legacy_state *st = iio_priv(indio_dev);
260+
261+ /* Clear capture data. */
262+ memset(st->capture_data, 0, sizeof(st->capture_data));
263+
264+ /*
265+ * Read data based on which channels are enabled in scan mask. Note
266+ * that on a capture we are always reading the calibrated data.
267+ */
268+ read_ec_accel_data(st, *indio_dev->active_scan_mask, st->capture_data);
269+
270+ iio_push_to_buffers_with_timestamp(indio_dev, (void *)st->capture_data,
271+ iio_get_time_ns(indio_dev));
272+
273+ /*
274+ * Tell the core we are done with this trigger and ready for the
275+ * next one.
276+ */
277+ iio_trigger_notify_done(indio_dev->trig);
278+
279+ return IRQ_HANDLED;
280+}
281+
282+static char *cros_ec_accel_legacy_loc_strings[] = {
283+ [MOTIONSENSE_LOC_BASE] = "base",
284+ [MOTIONSENSE_LOC_LID] = "lid",
285+ [MOTIONSENSE_LOC_MAX] = "unknown",
286+};
287+
288+static ssize_t cros_ec_accel_legacy_loc(struct iio_dev *indio_dev,
289+ uintptr_t private,
290+ const struct iio_chan_spec *chan,
291+ char *buf)
292+{
293+ struct cros_ec_accel_legacy_state *st = iio_priv(indio_dev);
294+
295+ return sprintf(buf, "%s\n",
296+ cros_ec_accel_legacy_loc_strings[st->sensor_num +
297+ MOTIONSENSE_LOC_BASE]);
298+}
299+
300+static ssize_t cros_ec_accel_legacy_id(struct iio_dev *indio_dev,
301+ uintptr_t private,
302+ const struct iio_chan_spec *chan,
303+ char *buf)
304+{
305+ struct cros_ec_accel_legacy_state *st = iio_priv(indio_dev);
306+
307+ return sprintf(buf, "%d\n", st->sensor_num);
308+}
309+
310+static const struct iio_chan_spec_ext_info cros_ec_accel_legacy_ext_info[] = {
311+ {
312+ .name = "id",
313+ .shared = IIO_SHARED_BY_ALL,
314+ .read = cros_ec_accel_legacy_id,
315+ },
316+ {
317+ .name = "location",
318+ .shared = IIO_SHARED_BY_ALL,
319+ .read = cros_ec_accel_legacy_loc,
320+ },
321+ { }
322+};
323+
324+#define CROS_EC_ACCEL_LEGACY_CHAN(_axis) \
325+ { \
326+ .type = IIO_ACCEL, \
327+ .channel2 = IIO_MOD_X + (_axis), \
328+ .modified = 1, \
329+ .info_mask_separate = \
330+ BIT(IIO_CHAN_INFO_RAW) | \
331+ BIT(IIO_CHAN_INFO_SCALE) | \
332+ BIT(IIO_CHAN_INFO_CALIBBIAS), \
333+ .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE), \
334+ .ext_info = cros_ec_accel_legacy_ext_info, \
335+ .scan_type = { \
336+ .sign = 's', \
337+ .realbits = 16, \
338+ .storagebits = 16, \
339+ }, \
340+ } \
341+
342+static struct iio_chan_spec ec_accel_channels[] = {
343+ CROS_EC_ACCEL_LEGACY_CHAN(X),
344+ CROS_EC_ACCEL_LEGACY_CHAN(Y),
345+ CROS_EC_ACCEL_LEGACY_CHAN(Z),
346+ IIO_CHAN_SOFT_TIMESTAMP(MAX_AXIS)
347+};
348+
349+static int cros_ec_accel_legacy_probe(struct platform_device *pdev)
350+{
351+ struct device *dev = &pdev->dev;
352+ struct cros_ec_dev *ec = dev_get_drvdata(dev->parent);
353+ struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev);
354+ struct iio_dev *indio_dev;
355+ struct cros_ec_accel_legacy_state *state;
356+ int ret, i;
357+
358+ if (!ec || !ec->ec_dev) {
359+ dev_warn(&pdev->dev, "No EC device found.\n");
360+ return -EINVAL;
361+ }
362+
363+ if (!ec->ec_dev->cmd_readmem) {
364+ dev_warn(&pdev->dev, "EC does not support direct reads.\n");
365+ return -EINVAL;
366+ }
367+
368+ indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*state));
369+ if (!indio_dev)
370+ return -ENOMEM;
371+
372+ platform_set_drvdata(pdev, indio_dev);
373+ state = iio_priv(indio_dev);
374+ state->ec = ec->ec_dev;
375+ state->sensor_num = sensor_platform->sensor_num;
376+
377+ indio_dev->dev.parent = dev;
378+ indio_dev->name = pdev->name;
379+ indio_dev->channels = ec_accel_channels;
380+ /*
381+ * Present the channel using HTML5 standard:
382+ * need to invert X and Y and invert some lid axis.
383+ */
384+ for (i = X ; i < MAX_AXIS; i++) {
385+ switch (i) {
386+ case X:
387+ ec_accel_channels[X].scan_index = Y;
388+ case Y:
389+ ec_accel_channels[Y].scan_index = X;
390+ case Z:
391+ ec_accel_channels[Z].scan_index = Z;
392+ }
393+ if (state->sensor_num == MOTIONSENSE_LOC_LID && i != Y)
394+ state->sign[i] = -1;
395+ else
396+ state->sign[i] = 1;
397+ }
398+ indio_dev->num_channels = ARRAY_SIZE(ec_accel_channels);
399+ indio_dev->dev.parent = &pdev->dev;
400+ indio_dev->info = &cros_ec_accel_legacy_info;
401+ indio_dev->modes = INDIO_DIRECT_MODE;
402+
403+ ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
404+ cros_ec_accel_legacy_capture,
405+ NULL);
406+ if (ret)
407+ return ret;
408+
409+ return devm_iio_device_register(dev, indio_dev);
410+}
411+
412+static struct platform_driver cros_ec_accel_platform_driver = {
413+ .driver = {
414+ .name = DRV_NAME,
415+ },
416+ .probe = cros_ec_accel_legacy_probe,
417+};
418+module_platform_driver(cros_ec_accel_platform_driver);
419+
420+MODULE_DESCRIPTION("ChromeOS EC legacy accelerometer driver");
421+MODULE_AUTHOR("Gwendal Grignou <gwendal@chromium.org>");
422+MODULE_LICENSE("GPL");
423+MODULE_ALIAS("platform:" DRV_NAME);
drivers/iio/accel/da280.c+0−1
@@ -88,7 +88,6 @@ static int da280_read_raw(struct iio_dev *indio_dev, · 87 unmodified lines
8888 }
8989
9090 static const struct iio_info da280_info = {
91− .driver_module = THIS_MODULE,
9291 .read_raw = da280_read_raw,
9392 };
9493
drivers/iio/accel/da311.c+0−1
@@ -212,7 +212,6 @@ static int da311_read_raw(struct iio_dev *indio_dev, · 211 unmodified lines
212212 }
213213
214214 static const struct iio_info da311_info = {
215− .driver_module = THIS_MODULE,
216215 .read_raw = da311_read_raw,
217216 };
218217
drivers/iio/accel/dmard06.c+0−1
@@ -124,7 +124,6 @@ static int dmard06_read_raw(struct iio_dev *indio_dev, · 123 unmodified lines
124124 }
125125
126126 static const struct iio_info dmard06_info = {
127− .driver_module = THIS_MODULE,
128127 .read_raw = dmard06_read_raw,
129128 };
130129
drivers/iio/accel/dmard09.c+0−1
@@ -93,7 +93,6 @@ static int dmard09_read_raw(struct iio_dev *indio_dev, · 92 unmodified lines
9393 }
9494
9595 static const struct iio_info dmard09_info = {
96− .driver_module = THIS_MODULE,
9796 .read_raw = dmard09_read_raw,
9897 };
9998
drivers/iio/accel/dmard10.c+0−1
@@ -170,7 +170,6 @@ static int dmard10_read_raw(struct iio_dev *indio_dev, · 169 unmodified lines
170170 }
171171
172172 static const struct iio_info dmard10_info = {
173− .driver_module = THIS_MODULE,
174173 .read_raw = dmard10_read_raw,
175174 };
176175
drivers/iio/accel/hid-sensor-accel-3d.c+0−1
@@ -225,7 +225,6 @@ static int accel_3d_write_raw(struct iio_dev *indio_dev, · 224 unmodified lines
225225 }
226226
227227 static const struct iio_info accel_3d_info = {
228− .driver_module = THIS_MODULE,
229228 .read_raw = &accel_3d_read_raw,
230229 .write_raw = &accel_3d_write_raw,
231230 };
drivers/iio/accel/kxcjk-1013.c+227−129
@@ -34,6 +34,13 @@ · 33 unmodified lines
3434 #define KXCJK1013_DRV_NAME "kxcjk1013"
3535 #define KXCJK1013_IRQ_NAME "kxcjk1013_event"
3636
37+#define KXTF9_REG_HP_XOUT_L 0x00
38+#define KXTF9_REG_HP_XOUT_H 0x01
39+#define KXTF9_REG_HP_YOUT_L 0x02
40+#define KXTF9_REG_HP_YOUT_H 0x03
41+#define KXTF9_REG_HP_ZOUT_L 0x04
42+#define KXTF9_REG_HP_ZOUT_H 0x05
43+
3744 #define KXCJK1013_REG_XOUT_L 0x06
3845 /*
3946 * From low byte X axis register, all the other addresses of Y and Z can be
@@ -48,17 +55,33 @@ · 8 unmodified lines
4855
4956 #define KXCJK1013_REG_DCST_RESP 0x0C
5057 #define KXCJK1013_REG_WHO_AM_I 0x0F
51−#define KXCJK1013_REG_INT_SRC1 0x16
58+#define KXTF9_REG_TILT_POS_CUR 0x10
59+#define KXTF9_REG_TILT_POS_PREV 0x11
60+#define KXTF9_REG_INT_SRC1 0x15
61+#define KXCJK1013_REG_INT_SRC1 0x16 /* compatible, but called INT_SRC2 in KXTF9 ds */
5262 #define KXCJK1013_REG_INT_SRC2 0x17
5363 #define KXCJK1013_REG_STATUS_REG 0x18
5464 #define KXCJK1013_REG_INT_REL 0x1A
5565 #define KXCJK1013_REG_CTRL1 0x1B
56−#define KXCJK1013_REG_CTRL2 0x1D
66+#define KXTF9_REG_CTRL2 0x1C
67+#define KXCJK1013_REG_CTRL2 0x1D /* mostly compatible, CTRL_REG3 in KTXF9 ds */
5768 #define KXCJK1013_REG_INT_CTRL1 0x1E
5869 #define KXCJK1013_REG_INT_CTRL2 0x1F
70+#define KXTF9_REG_INT_CTRL3 0x20
5971 #define KXCJK1013_REG_DATA_CTRL 0x21
72+#define KXTF9_REG_TILT_TIMER 0x28
6073 #define KXCJK1013_REG_WAKE_TIMER 0x29
74+#define KXTF9_REG_TDT_TIMER 0x2B
75+#define KXTF9_REG_TDT_THRESH_H 0x2C
76+#define KXTF9_REG_TDT_THRESH_L 0x2D
77+#define KXTF9_REG_TDT_TAP_TIMER 0x2E
78+#define KXTF9_REG_TDT_TOTAL_TIMER 0x2F
79+#define KXTF9_REG_TDT_LATENCY_TIMER 0x30
80+#define KXTF9_REG_TDT_WINDOW_TIMER 0x31
6181 #define KXCJK1013_REG_SELF_TEST 0x3A
82+#define KXTF9_REG_WAKE_THRESH 0x5A
83+#define KXTF9_REG_TILT_ANGLE 0x5C
84+#define KXTF9_REG_HYST_SET 0x5F
6285 #define KXCJK1013_REG_WAKE_THRES 0x6A
6386
6487 #define KXCJK1013_REG_CTRL1_BIT_PC1 BIT(7)
@@ -67,14 +90,33 @@ · 2 unmodified lines
6790 #define KXCJK1013_REG_CTRL1_BIT_GSEL1 BIT(4)
6891 #define KXCJK1013_REG_CTRL1_BIT_GSEL0 BIT(3)
6992 #define KXCJK1013_REG_CTRL1_BIT_WUFE BIT(1)
70−#define KXCJK1013_REG_INT_REG1_BIT_IEA BIT(4)
71−#define KXCJK1013_REG_INT_REG1_BIT_IEN BIT(5)
93+
94+#define KXCJK1013_REG_INT_CTRL1_BIT_IEU BIT(2) /* KXTF9 */
95+#define KXCJK1013_REG_INT_CTRL1_BIT_IEL BIT(3)
96+#define KXCJK1013_REG_INT_CTRL1_BIT_IEA BIT(4)
97+#define KXCJK1013_REG_INT_CTRL1_BIT_IEN BIT(5)
98+
99+#define KXTF9_REG_TILT_BIT_LEFT_EDGE BIT(5)
100+#define KXTF9_REG_TILT_BIT_RIGHT_EDGE BIT(4)
101+#define KXTF9_REG_TILT_BIT_LOWER_EDGE BIT(3)
102+#define KXTF9_REG_TILT_BIT_UPPER_EDGE BIT(2)
103+#define KXTF9_REG_TILT_BIT_FACE_DOWN BIT(1)
104+#define KXTF9_REG_TILT_BIT_FACE_UP BIT(0)
72105
73106 #define KXCJK1013_DATA_MASK_12_BIT 0x0FFF
74107 #define KXCJK1013_MAX_STARTUP_TIME_US 100000
75108
76109 #define KXCJK1013_SLEEP_DELAY_MS 2000
77110
111+#define KXCJK1013_REG_INT_SRC1_BIT_TPS BIT(0) /* KXTF9 */
112+#define KXCJK1013_REG_INT_SRC1_BIT_WUFS BIT(1)
113+#define KXCJK1013_REG_INT_SRC1_MASK_TDTS (BIT(2) | BIT(3)) /* KXTF9 */
114+#define KXCJK1013_REG_INT_SRC1_TAP_NONE 0
115+#define KXCJK1013_REG_INT_SRC1_TAP_SINGLE BIT(2)
116+#define KXCJK1013_REG_INT_SRC1_TAP_DOUBLE BIT(3)
117+#define KXCJK1013_REG_INT_SRC1_BIT_DRDY BIT(4)
118+
119+/* KXCJK: INT_SOURCE2: motion detect, KXTF9: INT_SRC_REG1: tap detect */
78120 #define KXCJK1013_REG_INT_SRC2_BIT_ZP BIT(0)
79121 #define KXCJK1013_REG_INT_SRC2_BIT_ZN BIT(1)
80122 #define KXCJK1013_REG_INT_SRC2_BIT_YP BIT(2)
@@ -88,6 +130,7 @@ enum kx_chipset { · 7 unmodified lines
88130 KXCJK1013,
89131 KXCJ91008,
90132 KXTJ21009,
133+ KXTF9,
91134 KX_MAX_CHIPS /* this must be last */
92135 };
93136
@@ -128,15 +171,42 @@ enum kxcjk1013_range { · 34 unmodified lines
128171 KXCJK1013_RANGE_8G,
129172 };
130173
131−static const struct {
174+struct kx_odr_map {
132175 int val;
133176 int val2;
134177 int odr_bits;
135−} samp_freq_table[] = { {0, 781000, 0x08}, {1, 563000, 0x09},
136− {3, 125000, 0x0A}, {6, 250000, 0x0B}, {12, 500000, 0},
137− {25, 0, 0x01}, {50, 0, 0x02}, {100, 0, 0x03},
138− {200, 0, 0x04}, {400, 0, 0x05}, {800, 0, 0x06},
139− {1600, 0, 0x07} };
178+ int wuf_bits;
179+};
180+
181+static const struct kx_odr_map samp_freq_table[] = {
182+ { 0, 781000, 0x08, 0x00 },
183+ { 1, 563000, 0x09, 0x01 },
184+ { 3, 125000, 0x0A, 0x02 },
185+ { 6, 250000, 0x0B, 0x03 },
186+ { 12, 500000, 0x00, 0x04 },
187+ { 25, 0, 0x01, 0x05 },
188+ { 50, 0, 0x02, 0x06 },
189+ { 100, 0, 0x03, 0x06 },
190+ { 200, 0, 0x04, 0x06 },
191+ { 400, 0, 0x05, 0x06 },
192+ { 800, 0, 0x06, 0x06 },
193+ { 1600, 0, 0x07, 0x06 },
194+};
195+
196+static const char *const kxcjk1013_samp_freq_avail =
197+ "0.781000 1.563000 3.125000 6.250000 12.500000 25 50 100 200 400 800 1600";
198+
199+static const struct kx_odr_map kxtf9_samp_freq_table[] = {
200+ { 25, 0, 0x01, 0x00 },
201+ { 50, 0, 0x02, 0x01 },
202+ { 100, 0, 0x03, 0x01 },
203+ { 200, 0, 0x04, 0x01 },
204+ { 400, 0, 0x05, 0x01 },
205+ { 800, 0, 0x06, 0x01 },
206+};
207+
208+static const char *const kxtf9_samp_freq_avail =
209+ "25 50 100 200 400 800";
140210
141211 /* Refer to section 4 of the specification */
142212 static const struct {
@@ -188,6 +258,15 @@ static const struct { · 45 unmodified lines
188258 {0x06, 3000},
189259 {0x07, 2000},
190260 },
261+ /* KXTF9 */
262+ {
263+ {0x01, 81000},
264+ {0x02, 41000},
265+ {0x03, 21000},
266+ {0x04, 11000},
267+ {0x05, 5100},
268+ {0x06, 2700},
269+ },
191270 };
192271
193272 static const struct {
@@ -198,23 +277,6 @@ static const struct { · 4 unmodified lines
198277 {19163, 1, 0},
199278 {38326, 0, 1} };
200279
201−static const struct {
202− int val;
203− int val2;
204− int odr_bits;
205−} wake_odr_data_rate_table[] = { {0, 781000, 0x00},
206− {1, 563000, 0x01},
207− {3, 125000, 0x02},
208− {6, 250000, 0x03},
209− {12, 500000, 0x04},
210− {25, 0, 0x05},
211− {50, 0, 0x06},
212− {100, 0, 0x06},
213− {200, 0, 0x06},
214− {400, 0, 0x06},
215− {800, 0, 0x06},
216− {1600, 0, 0x06} };
217−
218280 static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
219281 enum kxcjk1013_mode mode)
220282 {
@@ -341,9 +403,9 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *data) · 120 unmodified lines
341403 }
342404
343405 if (data->active_high_intr)
344− ret |= KXCJK1013_REG_INT_REG1_BIT_IEA;
406+ ret |= KXCJK1013_REG_INT_CTRL1_BIT_IEA;
345407 else
346− ret &= ~KXCJK1013_REG_INT_REG1_BIT_IEA;
408+ ret &= ~KXCJK1013_REG_INT_CTRL1_BIT_IEA;
347409
348410 ret = i2c_smbus_write_byte_data(data->client, KXCJK1013_REG_INT_CTRL1,
349411 ret);
@@ -401,7 +463,7 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on) · 51 unmodified lines
401463
402464 static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data)
403465 {
404− int ret;
466+ int waketh_reg, ret;
405467
406468 ret = i2c_smbus_write_byte_data(data->client,
407469 KXCJK1013_REG_WAKE_TIMER,
@@ -412,8 +474,9 @@ static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data) · 4 unmodified lines
412474 return ret;
413475 }
414476
415− ret = i2c_smbus_write_byte_data(data->client,
416− KXCJK1013_REG_WAKE_THRES,
477+ waketh_reg = data->chipset == KXTF9 ?
478+ KXTF9_REG_WAKE_THRESH : KXCJK1013_REG_WAKE_THRES;
479+ ret = i2c_smbus_write_byte_data(data->client, waketh_reg,
417480 data->wake_thres);
418481 if (ret < 0) {
419482 dev_err(&data->client->dev, "Error writing reg_wake_thres\n");
@@ -449,9 +512,9 @@ static int kxcjk1013_setup_any_motion_interrupt(struct kxcjk1013_data *data, · 29 unmodified lines
449512 }
450513
451514 if (status)
452− ret |= KXCJK1013_REG_INT_REG1_BIT_IEN;
515+ ret |= KXCJK1013_REG_INT_CTRL1_BIT_IEN;
453516 else
454− ret &= ~KXCJK1013_REG_INT_REG1_BIT_IEN;
517+ ret &= ~KXCJK1013_REG_INT_CTRL1_BIT_IEN;
455518
456519 ret = i2c_smbus_write_byte_data(data->client, KXCJK1013_REG_INT_CTRL1,
457520 ret);
@@ -509,9 +572,9 @@ static int kxcjk1013_setup_new_data_interrupt(struct kxcjk1013_data *data, · 51 unmodified lines
509572 }
510573
511574 if (status)
512− ret |= KXCJK1013_REG_INT_REG1_BIT_IEN;
575+ ret |= KXCJK1013_REG_INT_CTRL1_BIT_IEN;
513576 else
514− ret &= ~KXCJK1013_REG_INT_REG1_BIT_IEN;
577+ ret &= ~KXCJK1013_REG_INT_CTRL1_BIT_IEN;
515578
516579 ret = i2c_smbus_write_byte_data(data->client, KXCJK1013_REG_INT_CTRL1,
517580 ret);
@@ -547,28 +610,30 @@ static int kxcjk1013_setup_new_data_interrupt(struct kxcjk1013_data *data, · 29 unmodified lines
547610 return 0;
548611 }
549612
550−static int kxcjk1013_convert_freq_to_bit(int val, int val2)
613+static const struct kx_odr_map *kxcjk1013_find_odr_value(
614+ const struct kx_odr_map *map, size_t map_size, int val, int val2)
551615 {
552616 int i;
553617
554− for (i = 0; i < ARRAY_SIZE(samp_freq_table); ++i) {
555− if (samp_freq_table[i].val == val &&
556− samp_freq_table[i].val2 == val2) {
557− return samp_freq_table[i].odr_bits;
558− }
618+ for (i = 0; i < map_size; ++i) {
619+ if (map[i].val == val && map[i].val2 == val2)
620+ return &map[i];
559621 }
560622
561− return -EINVAL;
623+ return ERR_PTR(-EINVAL);
562624 }
563625
564−static int kxcjk1013_convert_wake_odr_to_bit(int val, int val2)
626+static int kxcjk1013_convert_odr_value(const struct kx_odr_map *map,
627+ size_t map_size, int odr_bits,
628+ int *val, int *val2)
565629 {
566630 int i;
567631
568− for (i = 0; i < ARRAY_SIZE(wake_odr_data_rate_table); ++i) {
569− if (wake_odr_data_rate_table[i].val == val &&
570− wake_odr_data_rate_table[i].val2 == val2) {
571− return wake_odr_data_rate_table[i].odr_bits;
632+ for (i = 0; i < map_size; ++i) {
633+ if (map[i].odr_bits == odr_bits) {
634+ *val = map[i].val;
635+ *val2 = map[i].val2;
636+ return IIO_VAL_INT_PLUS_MICRO;
572637 }
573638 }
574639
@@ -578,16 +643,24 @@ static int kxcjk1013_convert_wake_odr_to_bit(int val, int val2) · 3 unmodified lines
578643 static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val2)
579644 {
580645 int ret;
581− int odr_bits;
582646 enum kxcjk1013_mode store_mode;
647+ const struct kx_odr_map *odr_setting;
583648
584649 ret = kxcjk1013_get_mode(data, &store_mode);
585650 if (ret < 0)
586651 return ret;
587652
588− odr_bits = kxcjk1013_convert_freq_to_bit(val, val2);
589− if (odr_bits < 0)
590− return odr_bits;
653+ if (data->chipset == KXTF9)
654+ odr_setting = kxcjk1013_find_odr_value(kxtf9_samp_freq_table,
655+ ARRAY_SIZE(kxtf9_samp_freq_table),
656+ val, val2);
657+ else
658+ odr_setting = kxcjk1013_find_odr_value(samp_freq_table,
659+ ARRAY_SIZE(samp_freq_table),
660+ val, val2);
661+
662+ if (IS_ERR(odr_setting))
663+ return PTR_ERR(odr_setting);
591664
592665 /* To change ODR, the chip must be set to STANDBY as per spec */
593666 ret = kxcjk1013_set_mode(data, STANDBY);
@@ -595,20 +668,16 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val2) · 1 unmodified line
595668 return ret;
596669
597670 ret = i2c_smbus_write_byte_data(data->client, KXCJK1013_REG_DATA_CTRL,
598− odr_bits);
671+ odr_setting->odr_bits);
599672 if (ret < 0) {
600673 dev_err(&data->client->dev, "Error writing data_ctrl\n");
601674 return ret;
602675 }
603676
604− data->odr_bits = odr_bits;
605−
606− odr_bits = kxcjk1013_convert_wake_odr_to_bit(val, val2);
607− if (odr_bits < 0)
608− return odr_bits;
677+ data->odr_bits = odr_setting->odr_bits;
609678
610679 ret = i2c_smbus_write_byte_data(data->client, KXCJK1013_REG_CTRL2,
611− odr_bits);
680+ odr_setting->wuf_bits);
612681 if (ret < 0) {
613682 dev_err(&data->client->dev, "Error writing reg_ctrl2\n");
614683 return ret;
@@ -625,17 +694,14 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val2) · 10 unmodified lines
625694
626695 static int kxcjk1013_get_odr(struct kxcjk1013_data *data, int *val, int *val2)
627696 {
628− int i;
629−
630− for (i = 0; i < ARRAY_SIZE(samp_freq_table); ++i) {
631− if (samp_freq_table[i].odr_bits == data->odr_bits) {
632− *val = samp_freq_table[i].val;
633− *val2 = samp_freq_table[i].val2;
634− return IIO_VAL_INT_PLUS_MICRO;
635− }
636− }
637−
638− return -EINVAL;
697+ if (data->chipset == KXTF9)
698+ return kxcjk1013_convert_odr_value(kxtf9_samp_freq_table,
699+ ARRAY_SIZE(kxtf9_samp_freq_table),
700+ data->odr_bits, val, val2);
701+ else
702+ return kxcjk1013_convert_odr_value(samp_freq_table,
703+ ARRAY_SIZE(samp_freq_table),
704+ data->odr_bits, val, val2);
639705 }
640706
641707 static int kxcjk1013_get_acc_reg(struct kxcjk1013_data *data, int axis)
@@ -886,13 +952,29 @@ static int kxcjk1013_buffer_postdisable(struct iio_dev *indio_dev) · 244 unmodified lines
886952 return kxcjk1013_set_power_state(data, false);
887953 }
888954
889−static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
890− "0.781000 1.563000 3.125000 6.250000 12.500000 25 50 100 200 400 800 1600");
955+static ssize_t kxcjk1013_get_samp_freq_avail(struct device *dev,
956+ struct device_attribute *attr,
957+ char *buf)
958+{
959+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
960+ struct kxcjk1013_data *data = iio_priv(indio_dev);
961+ const char *str;
962+
963+ if (data->chipset == KXTF9)
964+ str = kxtf9_samp_freq_avail;
965+ else
966+ str = kxcjk1013_samp_freq_avail;
967+
968+ return sprintf(buf, "%s\n", str);
969+}
970+
971+static IIO_DEVICE_ATTR(in_accel_sampling_frequency_available, S_IRUGO,
972+ kxcjk1013_get_samp_freq_avail, NULL, 0);
891973
892974 static IIO_CONST_ATTR(in_accel_scale_available, "0.009582 0.019163 0.038326");
893975
894976 static struct attribute *kxcjk1013_attributes[] = {
895− &iio_const_attr_sampling_frequency_available.dev_attr.attr,
977+ &iio_dev_attr_in_accel_sampling_frequency_available.dev_attr.attr,
896978 &iio_const_attr_in_accel_scale_available.dev_attr.attr,
897979 NULL,
898980 };
@@ -950,7 +1032,6 @@ static const struct iio_info kxcjk1013_info = { · 51 unmodified lines
9501032 .write_event_value = kxcjk1013_write_event,
9511033 .write_event_config = kxcjk1013_write_event_config,
9521034 .read_event_config = kxcjk1013_read_event_config,
953− .driver_module = THIS_MODULE,
9541035 };
9551036
9561037 static const unsigned long kxcjk1013_scan_masks[] = {0x7, 0};
@@ -1036,9 +1117,74 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig, · 79 unmodified lines
10361117 static const struct iio_trigger_ops kxcjk1013_trigger_ops = {
10371118 .set_trigger_state = kxcjk1013_data_rdy_trigger_set_state,
10381119 .try_reenable = kxcjk1013_trig_try_reen,
1039− .owner = THIS_MODULE,
10401120 };
10411121
1122+static void kxcjk1013_report_motion_event(struct iio_dev *indio_dev)
1123+{
1124+ struct kxcjk1013_data *data = iio_priv(indio_dev);
1125+
1126+ int ret = i2c_smbus_read_byte_data(data->client,
1127+ KXCJK1013_REG_INT_SRC2);
1128+ if (ret < 0) {
1129+ dev_err(&data->client->dev, "Error reading reg_int_src2\n");
1130+ return;
1131+ }
1132+
1133+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_XN)
1134+ iio_push_event(indio_dev,
1135+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1136+ 0,
1137+ IIO_MOD_X,
1138+ IIO_EV_TYPE_THRESH,
1139+ IIO_EV_DIR_FALLING),
1140+ data->timestamp);
1141+
1142+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_XP)
1143+ iio_push_event(indio_dev,
1144+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1145+ 0,
1146+ IIO_MOD_X,
1147+ IIO_EV_TYPE_THRESH,
1148+ IIO_EV_DIR_RISING),
1149+ data->timestamp);
1150+
1151+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_YN)
1152+ iio_push_event(indio_dev,
1153+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1154+ 0,
1155+ IIO_MOD_Y,
1156+ IIO_EV_TYPE_THRESH,
1157+ IIO_EV_DIR_FALLING),
1158+ data->timestamp);
1159+
1160+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_YP)
1161+ iio_push_event(indio_dev,
1162+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1163+ 0,
1164+ IIO_MOD_Y,
1165+ IIO_EV_TYPE_THRESH,
1166+ IIO_EV_DIR_RISING),
1167+ data->timestamp);
1168+
1169+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_ZN)
1170+ iio_push_event(indio_dev,
1171+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1172+ 0,
1173+ IIO_MOD_Z,
1174+ IIO_EV_TYPE_THRESH,
1175+ IIO_EV_DIR_FALLING),
1176+ data->timestamp);
1177+
1178+ if (ret & KXCJK1013_REG_INT_SRC2_BIT_ZP)
1179+ iio_push_event(indio_dev,
1180+ IIO_MOD_EVENT_CODE(IIO_ACCEL,
1181+ 0,
1182+ IIO_MOD_Z,
1183+ IIO_EV_TYPE_THRESH,
1184+ IIO_EV_DIR_RISING),
1185+ data->timestamp);
1186+}
1187+
10421188 static irqreturn_t kxcjk1013_event_handler(int irq, void *private)
10431189 {
10441190 struct iio_dev *indio_dev = private;
@@ -1051,66 +1197,17 @@ static irqreturn_t kxcjk1013_event_handler(int irq, void *private) · 6 unmodified lines
10511197 goto ack_intr;
10521198 }
10531199
1054− if (ret & 0x02) {
1055− ret = i2c_smbus_read_byte_data(data->client,
1056− KXCJK1013_REG_INT_SRC2);
1057− if (ret < 0) {
1058− dev_err(&data->client->dev,
1059− "Error reading reg_int_src2\n");
1060− goto ack_intr;
1061− }
1062−
1063− if (ret & KXCJK1013_REG_INT_SRC2_BIT_XN)
1064− iio_push_event(indio_dev,
1065− IIO_MOD_EVENT_CODE(IIO_ACCEL,
1066− 0,
1067− IIO_MOD_X,
1068− IIO_EV_TYPE_THRESH,
1069− IIO_EV_DIR_FALLING),
1070− data->timestamp);
1071− if (ret & KXCJK1013_REG_INT_SRC2_BIT_XP)
1072− iio_push_event(indio_dev,
1073− IIO_MOD_EVENT_CODE(IIO_ACCEL,
1074− 0,
1075− IIO_MOD_X,
1076− IIO_EV_TYPE_THRESH,
1077− IIO_EV_DIR_RISING),
1078− data->timestamp);
1079−
1080−
1081− if (ret & KXCJK1013_REG_INT_SRC2_BIT_YN)
1082− iio_push_event(indio_dev,
1083− IIO_MOD_EVENT_CODE(IIO_ACCEL,
1084− 0,
1085− IIO_MOD_Y,
1086− IIO_EV_TYPE_THRESH,
1087− IIO_EV_DIR_FALLING),
1088− data->timestamp);
1089− if (ret & KXCJK1013_REG_INT_SRC2_BIT_YP)
1090− iio_push_event(indio_dev,
1091− IIO_MOD_EVENT_CODE(IIO_ACCEL,
1092− 0,
1093− IIO_MOD_Y,
1094− IIO_EV_TYPE_THRESH,
1095− IIO_EV_DIR_RISING),
1096− data->timestamp);
1097−
1098− if (ret & KXCJK1013_REG_INT_SRC2_BIT_ZN)
1099− iio_push_event(indio_dev,
1100− IIO_MOD_EVENT_CODE(IIO_ACCEL,
1101− 0,
1102− IIO_MOD_Z,
1103− IIO_EV_TYPE_THRESH,
1104− IIO_EV_DIR_FALLING),
1105− data->timestamp);
1106− if (ret & KXCJK1013_REG_INT_SRC2_BIT_ZP)
1200+ if (ret & KXCJK1013_REG_INT_SRC1_BIT_WUFS) {
1201+ if (data->chipset == KXTF9)
11071202 iio_push_event(indio_dev,
11081203 IIO_MOD_EVENT_CODE(IIO_ACCEL,
11091204 0,
1110− IIO_MOD_Z,
1205+ IIO_MOD_X_AND_Y_AND_Z,
11111206 IIO_EV_TYPE_THRESH,
11121207 IIO_EV_DIR_RISING),
11131208 data->timestamp);
1209+ else
1210+ kxcjk1013_report_motion_event(indio_dev);
11141211 }
11151212
11161213 ack_intr:
@@ -1403,6 +1500,7 @@ static const struct i2c_device_id kxcjk1013_id[] = { · 286 unmodified lines
14031500 {"kxcjk1013", KXCJK1013},
14041501 {"kxcj91008", KXCJ91008},
14051502 {"kxtj21009", KXTJ21009},
1503+ {"kxtf9", KXTF9},
14061504 {"SMO8500", KXCJ91008},
14071505 {}
14081506 };
drivers/iio/accel/kxsd9.c+0−1
@@ -390,7 +390,6 @@ static const struct iio_info kxsd9_info = { · 389 unmodified lines
390390 .read_raw = &kxsd9_read_raw,
391391 .write_raw = &kxsd9_write_raw,
392392 .attrs = &kxsd9_attribute_group,
393− .driver_module = THIS_MODULE,
394393 };
395394
396395 /* Four channels apart from timestamp, scan mask = 0x0f */
drivers/iio/accel/mc3230.c+0−1
@@ -107,7 +107,6 @@ static int mc3230_read_raw(struct iio_dev *indio_dev, · 106 unmodified lines
107107 }
108108
109109 static const struct iio_info mc3230_info = {
110− .driver_module = THIS_MODULE,
111110 .read_raw = mc3230_read_raw,
112111 };
113112
drivers/iio/accel/mma7455_core.c+0−1
@@ -199,7 +199,6 @@ static const struct iio_info mma7455_info = { · 198 unmodified lines
199199 .attrs = &mma7455_group,
200200 .read_raw = mma7455_read_raw,
201201 .write_raw = mma7455_write_raw,
202− .driver_module = THIS_MODULE,
203202 };
204203
205204 #define MMA7455_CHANNEL(axis, idx) { \
drivers/iio/accel/mma7660.c+0−1
@@ -168,7 +168,6 @@ static int mma7660_read_raw(struct iio_dev *indio_dev, · 167 unmodified lines
168168 }
169169
170170 static const struct iio_info mma7660_info = {
171− .driver_module = THIS_MODULE,
172171 .read_raw = mma7660_read_raw,
173172 .attrs = &mma7660_attribute_group,
174173 };
drivers/iio/accel/mma8452.c+215−168
@@ -59,7 +59,9 @@ · 58 unmodified lines
5959 #define MMA8452_FF_MT_THS 0x17
6060 #define MMA8452_FF_MT_THS_MASK 0x7f
6161 #define MMA8452_FF_MT_COUNT 0x18
62+#define MMA8452_FF_MT_CHAN_SHIFT 3
6263 #define MMA8452_TRANSIENT_CFG 0x1d
64+#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1)
6365 #define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0)
6466 #define MMA8452_TRANSIENT_CFG_ELE BIT(4)
6567 #define MMA8452_TRANSIENT_SRC 0x1e
@@ -69,6 +71,7 @@ · 3 unmodified lines
6971 #define MMA8452_TRANSIENT_THS 0x1f
7072 #define MMA8452_TRANSIENT_THS_MASK GENMASK(6, 0)
7173 #define MMA8452_TRANSIENT_COUNT 0x20
74+#define MMA8452_TRANSIENT_CHAN_SHIFT 1
7275 #define MMA8452_CTRL_REG1 0x2a
7376 #define MMA8452_CTRL_ACTIVE BIT(0)
7477 #define MMA8452_CTRL_DR_MASK GENMASK(5, 3)
@@ -107,6 +110,51 @@ struct mma8452_data { · 32 unmodified lines
107110 const struct mma_chip_info *chip_info;
108111 };
109112
113+ /**
114+ * struct mma8452_event_regs - chip specific data related to events
115+ * @ev_cfg: event config register address
116+ * @ev_cfg_ele: latch bit in event config register
117+ * @ev_cfg_chan_shift: number of the bit to enable events in X
118+ * direction; in event config register
119+ * @ev_src: event source register address
120+ * @ev_ths: event threshold register address
121+ * @ev_ths_mask: mask for the threshold value
122+ * @ev_count: event count (period) register address
123+ *
124+ * Since not all chips supported by the driver support comparing high pass
125+ * filtered data for events (interrupts), different interrupt sources are
126+ * used for different chips and the relevant registers are included here.
127+ */
128+struct mma8452_event_regs {
129+ u8 ev_cfg;
130+ u8 ev_cfg_ele;
131+ u8 ev_cfg_chan_shift;
132+ u8 ev_src;
133+ u8 ev_ths;
134+ u8 ev_ths_mask;
135+ u8 ev_count;
136+};
137+
138+static const struct mma8452_event_regs ev_regs_accel_falling = {
139+ .ev_cfg = MMA8452_FF_MT_CFG,
140+ .ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
141+ .ev_cfg_chan_shift = MMA8452_FF_MT_CHAN_SHIFT,
142+ .ev_src = MMA8452_FF_MT_SRC,
143+ .ev_ths = MMA8452_FF_MT_THS,
144+ .ev_ths_mask = MMA8452_FF_MT_THS_MASK,
145+ .ev_count = MMA8452_FF_MT_COUNT
146+};
147+
148+static const struct mma8452_event_regs ev_regs_accel_rising = {
149+ .ev_cfg = MMA8452_TRANSIENT_CFG,
150+ .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
151+ .ev_cfg_chan_shift = MMA8452_TRANSIENT_CHAN_SHIFT,
152+ .ev_src = MMA8452_TRANSIENT_SRC,
153+ .ev_ths = MMA8452_TRANSIENT_THS,
154+ .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
155+ .ev_count = MMA8452_TRANSIENT_COUNT,
156+};
157+
110158 /**
111159 * struct mma_chip_info - chip specific data
112160 * @chip_id: WHO_AM_I register's value
@@ -116,40 +164,16 @@ struct mma8452_data { · 3 unmodified lines
116164 * @mma_scales: scale factors for converting register values
117165 * to m/s^2; 3 modes: 2g, 4g, 8g; 2 integers
118166 * per mode: m/s^2 and micro m/s^2
119− * @ev_cfg: event config register address
120− * @ev_cfg_ele: latch bit in event config register
121− * @ev_cfg_chan_shift: number of the bit to enable events in X
122− * direction; in event config register
123− * @ev_src: event source register address
124− * @ev_src_xe: bit in event source register that indicates
125− * an event in X direction
126− * @ev_src_ye: bit in event source register that indicates
127− * an event in Y direction
128− * @ev_src_ze: bit in event source register that indicates
129− * an event in Z direction
130− * @ev_ths: event threshold register address
131− * @ev_ths_mask: mask for the threshold value
132− * @ev_count: event count (period) register address
133− *
134− * Since not all chips supported by the driver support comparing high pass
135− * filtered data for events (interrupts), different interrupt sources are
136− * used for different chips and the relevant registers are included here.
167+ * @all_events: all events supported by this chip
168+ * @enabled_events: event flags enabled and handled by this driver
137169 */
138170 struct mma_chip_info {
139171 u8 chip_id;
140172 const struct iio_chan_spec *channels;
141173 int num_channels;
142174 const int mma_scales[3][2];
143− u8 ev_cfg;
144− u8 ev_cfg_ele;
145− u8 ev_cfg_chan_shift;
146− u8 ev_src;
147− u8 ev_src_xe;
148− u8 ev_src_ye;
149− u8 ev_src_ze;
150− u8 ev_ths;
151− u8 ev_ths_mask;
152− u8 ev_count;
175+ int all_events;
176+ int enabled_events;
153177 };
154178
155179 enum {
@@ -394,11 +418,11 @@ static ssize_t mma8452_show_os_ratio_avail(struct device *dev, · 238 unmodified lines
394418 }
395419
396420 static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(mma8452_show_samp_freq_avail);
397−static IIO_DEVICE_ATTR(in_accel_scale_available, S_IRUGO,
421+static IIO_DEVICE_ATTR(in_accel_scale_available, 0444,
398422 mma8452_show_scale_avail, NULL, 0);
399423 static IIO_DEVICE_ATTR(in_accel_filter_high_pass_3db_frequency_available,
400− S_IRUGO, mma8452_show_hp_cutoff_avail, NULL, 0);
401−static IIO_DEVICE_ATTR(in_accel_oversampling_ratio_available, S_IRUGO,
424+ 0444, mma8452_show_hp_cutoff_avail, NULL, 0);
425+static IIO_DEVICE_ATTR(in_accel_oversampling_ratio_available, 0444,
402426 mma8452_show_os_ratio_avail, NULL, 0);
403427
404428 static int mma8452_get_samp_freq_index(struct mma8452_data *data,
@@ -602,9 +626,8 @@ static int mma8452_set_power_mode(struct mma8452_data *data, u8 mode) · 197 unmodified lines
602626 static int mma8452_freefall_mode_enabled(struct mma8452_data *data)
603627 {
604628 int val;
605− const struct mma_chip_info *chip = data->chip_info;
606629
607− val = i2c_smbus_read_byte_data(data->client, chip->ev_cfg);
630+ val = i2c_smbus_read_byte_data(data->client, MMA8452_FF_MT_CFG);
608631 if (val < 0)
609632 return val;
610633
@@ -614,29 +637,28 @@ static int mma8452_freefall_mode_enabled(struct mma8452_data *data) · 3 unmodified lines
614637 static int mma8452_set_freefall_mode(struct mma8452_data *data, bool state)
615638 {
616639 int val;
617− const struct mma_chip_info *chip = data->chip_info;
618640
619641 if ((state && mma8452_freefall_mode_enabled(data)) ||
620642 (!state && !(mma8452_freefall_mode_enabled(data))))
621643 return 0;
622644
623− val = i2c_smbus_read_byte_data(data->client, chip->ev_cfg);
645+ val = i2c_smbus_read_byte_data(data->client, MMA8452_FF_MT_CFG);
624646 if (val < 0)
625647 return val;
626648
627649 if (state) {
628− val |= BIT(idx_x + chip->ev_cfg_chan_shift);
629− val |= BIT(idx_y + chip->ev_cfg_chan_shift);
630− val |= BIT(idx_z + chip->ev_cfg_chan_shift);
650+ val |= BIT(idx_x + MMA8452_FF_MT_CHAN_SHIFT);
651+ val |= BIT(idx_y + MMA8452_FF_MT_CHAN_SHIFT);
652+ val |= BIT(idx_z + MMA8452_FF_MT_CHAN_SHIFT);
631653 val &= ~MMA8452_FF_MT_CFG_OAE;
632654 } else {
633− val &= ~BIT(idx_x + chip->ev_cfg_chan_shift);
634− val &= ~BIT(idx_y + chip->ev_cfg_chan_shift);
635− val &= ~BIT(idx_z + chip->ev_cfg_chan_shift);
655+ val &= ~BIT(idx_x + MMA8452_FF_MT_CHAN_SHIFT);
656+ val &= ~BIT(idx_y + MMA8452_FF_MT_CHAN_SHIFT);
657+ val &= ~BIT(idx_z + MMA8452_FF_MT_CHAN_SHIFT);
636658 val |= MMA8452_FF_MT_CFG_OAE;
637659 }
638660
639− return mma8452_change_config(data, chip->ev_cfg, val);
661+ return mma8452_change_config(data, MMA8452_FF_MT_CFG, val);
640662 }
641663
642664 static int mma8452_set_hp_filter_frequency(struct mma8452_data *data,
@@ -740,7 +762,37 @@ static int mma8452_write_raw(struct iio_dev *indio_dev, · 97 unmodified lines
740762 return ret;
741763 }
742764
743−static int mma8452_read_thresh(struct iio_dev *indio_dev,
765+static int mma8452_get_event_regs(struct mma8452_data *data,
766+ const struct iio_chan_spec *chan, enum iio_event_direction dir,
767+ const struct mma8452_event_regs **ev_reg)
768+{
769+ if (!chan)
770+ return -EINVAL;
771+
772+ switch (chan->type) {
773+ case IIO_ACCEL:
774+ switch (dir) {
775+ case IIO_EV_DIR_RISING:
776+ if ((data->chip_info->all_events
777+ & MMA8452_INT_TRANS) &&
778+ (data->chip_info->enabled_events
779+ & MMA8452_INT_TRANS))
780+ *ev_reg = &ev_regs_accel_rising;
781+ else
782+ *ev_reg = &ev_regs_accel_falling;
783+ return 0;
784+ case IIO_EV_DIR_FALLING:
785+ *ev_reg = &ev_regs_accel_falling;
786+ return 0;
787+ default:
788+ return -EINVAL;
789+ }
790+ default:
791+ return -EINVAL;
792+ }
793+}
794+
795+static int mma8452_read_event_value(struct iio_dev *indio_dev,
744796 const struct iio_chan_spec *chan,
745797 enum iio_event_type type,
746798 enum iio_event_direction dir,
@@ -749,21 +801,24 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, · 2 unmodified lines
749801 {
750802 struct mma8452_data *data = iio_priv(indio_dev);
751803 int ret, us, power_mode;
804+ const struct mma8452_event_regs *ev_regs;
805+
806+ ret = mma8452_get_event_regs(data, chan, dir, &ev_regs);
807+ if (ret)
808+ return ret;
752809
753810 switch (info) {
754811 case IIO_EV_INFO_VALUE:
755− ret = i2c_smbus_read_byte_data(data->client,
756− data->chip_info->ev_ths);
812+ ret = i2c_smbus_read_byte_data(data->client, ev_regs->ev_ths);
757813 if (ret < 0)
758814 return ret;
759815
760− *val = ret & data->chip_info->ev_ths_mask;
816+ *val = ret & ev_regs->ev_ths_mask;
761817
762818 return IIO_VAL_INT;
763819
764820 case IIO_EV_INFO_PERIOD:
765− ret = i2c_smbus_read_byte_data(data->client,
766− data->chip_info->ev_count);
821+ ret = i2c_smbus_read_byte_data(data->client, ev_regs->ev_count);
767822 if (ret < 0)
768823 return ret;
769824
@@ -800,7 +855,7 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, · 30 unmodified lines
800855 }
801856 }
802857
803−static int mma8452_write_thresh(struct iio_dev *indio_dev,
858+static int mma8452_write_event_value(struct iio_dev *indio_dev,
804859 const struct iio_chan_spec *chan,
805860 enum iio_event_type type,
806861 enum iio_event_direction dir,
@@ -809,14 +864,18 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, · 2 unmodified lines
809864 {
810865 struct mma8452_data *data = iio_priv(indio_dev);
811866 int ret, reg, steps;
867+ const struct mma8452_event_regs *ev_regs;
868+
869+ ret = mma8452_get_event_regs(data, chan, dir, &ev_regs);
870+ if (ret)
871+ return ret;
812872
813873 switch (info) {
814874 case IIO_EV_INFO_VALUE:
815− if (val < 0 || val > MMA8452_TRANSIENT_THS_MASK)
875+ if (val < 0 || val > ev_regs->ev_ths_mask)
816876 return -EINVAL;
817877
818− return mma8452_change_config(data, data->chip_info->ev_ths,
819− val);
878+ return mma8452_change_config(data, ev_regs->ev_ths, val);
820879
821880 case IIO_EV_INFO_PERIOD:
822881 ret = mma8452_get_power_mode(data);
@@ -830,8 +889,7 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, · 7 unmodified lines
830889 if (steps < 0 || steps > 0xff)
831890 return -EINVAL;
832891
833− return mma8452_change_config(data, data->chip_info->ev_count,
834− steps);
892+ return mma8452_change_config(data, ev_regs->ev_count, steps);
835893
836894 case IIO_EV_INFO_HIGH_PASS_FILTER_3DB:
837895 reg = i2c_smbus_read_byte_data(data->client,
@@ -861,23 +919,24 @@ static int mma8452_read_event_config(struct iio_dev *indio_dev, · 23 unmodified lines
861919 enum iio_event_direction dir)
862920 {
863921 struct mma8452_data *data = iio_priv(indio_dev);
864− const struct mma_chip_info *chip = data->chip_info;
865922 int ret;
923+ const struct mma8452_event_regs *ev_regs;
924+
925+ ret = mma8452_get_event_regs(data, chan, dir, &ev_regs);
926+ if (ret)
927+ return ret;
866928
867929 switch (dir) {
868930 case IIO_EV_DIR_FALLING:
869931 return mma8452_freefall_mode_enabled(data);
870932 case IIO_EV_DIR_RISING:
871− if (mma8452_freefall_mode_enabled(data))
872− return 0;
873−
874933 ret = i2c_smbus_read_byte_data(data->client,
875− data->chip_info->ev_cfg);
934+ ev_regs->ev_cfg);
876935 if (ret < 0)
877936 return ret;
878937
879938 return !!(ret & BIT(chan->scan_index +
880− chip->ev_cfg_chan_shift));
939+ ev_regs->ev_cfg_chan_shift));
881940 default:
882941 return -EINVAL;
883942 }
@@ -890,8 +949,12 @@ static int mma8452_write_event_config(struct iio_dev *indio_dev, · 6 unmodified lines
890949 int state)
891950 {
892951 struct mma8452_data *data = iio_priv(indio_dev);
893− const struct mma_chip_info *chip = data->chip_info;
894952 int val, ret;
953+ const struct mma8452_event_regs *ev_regs;
954+
955+ ret = mma8452_get_event_regs(data, chan, dir, &ev_regs);
956+ if (ret)
957+ return ret;
895958
896959 ret = mma8452_set_runtime_pm_state(data->client, state);
897960 if (ret)
@@ -901,28 +964,30 @@ static int mma8452_write_event_config(struct iio_dev *indio_dev, · 3 unmodified lines
901964 case IIO_EV_DIR_FALLING:
902965 return mma8452_set_freefall_mode(data, state);
903966 case IIO_EV_DIR_RISING:
904− val = i2c_smbus_read_byte_data(data->client, chip->ev_cfg);
967+ val = i2c_smbus_read_byte_data(data->client, ev_regs->ev_cfg);
905968 if (val < 0)
906969 return val;
907970
908971 if (state) {
909972 if (mma8452_freefall_mode_enabled(data)) {
910− val &= ~BIT(idx_x + chip->ev_cfg_chan_shift);
911− val &= ~BIT(idx_y + chip->ev_cfg_chan_shift);
912− val &= ~BIT(idx_z + chip->ev_cfg_chan_shift);
973+ val &= ~BIT(idx_x + ev_regs->ev_cfg_chan_shift);
974+ val &= ~BIT(idx_y + ev_regs->ev_cfg_chan_shift);
975+ val &= ~BIT(idx_z + ev_regs->ev_cfg_chan_shift);
913976 val |= MMA8452_FF_MT_CFG_OAE;
914977 }
915− val |= BIT(chan->scan_index + chip->ev_cfg_chan_shift);
978+ val |= BIT(chan->scan_index +
979+ ev_regs->ev_cfg_chan_shift);
916980 } else {
917981 if (mma8452_freefall_mode_enabled(data))
918982 return 0;
919983
920− val &= ~BIT(chan->scan_index + chip->ev_cfg_chan_shift);
984+ val &= ~BIT(chan->scan_index +
985+ ev_regs->ev_cfg_chan_shift);
921986 }
922987
923− val |= chip->ev_cfg_ele;
988+ val |= ev_regs->ev_cfg_ele;
924989
925− return mma8452_change_config(data, chip->ev_cfg, val);
990+ return mma8452_change_config(data, ev_regs->ev_cfg, val);
926991 default:
927992 return -EINVAL;
928993 }
@@ -934,35 +999,25 @@ static void mma8452_transient_interrupt(struct iio_dev *indio_dev) · 5 unmodified lines
934999 s64 ts = iio_get_time_ns(indio_dev);
9351000 int src;
9361001
937− src = i2c_smbus_read_byte_data(data->client, data->chip_info->ev_src);
1002+ src = i2c_smbus_read_byte_data(data->client, MMA8452_TRANSIENT_SRC);
9381003 if (src < 0)
9391004 return;
9401005
941− if (mma8452_freefall_mode_enabled(data)) {
942− iio_push_event(indio_dev,
943− IIO_MOD_EVENT_CODE(IIO_ACCEL, 0,
944− IIO_MOD_X_AND_Y_AND_Z,
945− IIO_EV_TYPE_MAG,
946− IIO_EV_DIR_FALLING),
947− ts);
948− return;
949− }
950−
951− if (src & data->chip_info->ev_src_xe)
1006+ if (src & MMA8452_TRANSIENT_SRC_XTRANSE)
9521007 iio_push_event(indio_dev,
9531008 IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X,
9541009 IIO_EV_TYPE_MAG,
9551010 IIO_EV_DIR_RISING),
9561011 ts);
9571012
958− if (src & data->chip_info->ev_src_ye)
1013+ if (src & MMA8452_TRANSIENT_SRC_YTRANSE)
9591014 iio_push_event(indio_dev,
9601015 IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y,
9611016 IIO_EV_TYPE_MAG,
9621017 IIO_EV_DIR_RISING),
9631018 ts);
9641019
965− if (src & data->chip_info->ev_src_ze)
1020+ if (src & MMA8452_TRANSIENT_SRC_ZTRANSE)
9661021 iio_push_event(indio_dev,
9671022 IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z,
9681023 IIO_EV_TYPE_MAG,
@@ -974,7 +1029,6 @@ static irqreturn_t mma8452_interrupt(int irq, void *p) · 5 unmodified lines
9741029 {
9751030 struct iio_dev *indio_dev = p;
9761031 struct mma8452_data *data = iio_priv(indio_dev);
977− const struct mma_chip_info *chip = data->chip_info;
9781032 int ret = IRQ_NONE;
9791033 int src;
9801034
@@ -982,15 +1036,29 @@ static irqreturn_t mma8452_interrupt(int irq, void *p) · 1 unmodified line
9821036 if (src < 0)
9831037 return IRQ_NONE;
9841038
1039+ if (!(src & data->chip_info->enabled_events))
1040+ return IRQ_NONE;
1041+
9851042 if (src & MMA8452_INT_DRDY) {
9861043 iio_trigger_poll_chained(indio_dev->trig);
9871044 ret = IRQ_HANDLED;
9881045 }
9891046
990− if ((src & MMA8452_INT_TRANS &&
991− chip->ev_src == MMA8452_TRANSIENT_SRC) ||
992− (src & MMA8452_INT_FF_MT &&
993− chip->ev_src == MMA8452_FF_MT_SRC)) {
1047+ if (src & MMA8452_INT_FF_MT) {
1048+ if (mma8452_freefall_mode_enabled(data)) {
1049+ s64 ts = iio_get_time_ns(indio_dev);
1050+
1051+ iio_push_event(indio_dev,
1052+ IIO_MOD_EVENT_CODE(IIO_ACCEL, 0,
1053+ IIO_MOD_X_AND_Y_AND_Z,
1054+ IIO_EV_TYPE_MAG,
1055+ IIO_EV_DIR_FALLING),
1056+ ts);
1057+ }
1058+ ret = IRQ_HANDLED;
1059+ }
1060+
1061+ if (src & MMA8452_INT_TRANS) {
9941062 mma8452_transient_interrupt(indio_dev);
9951063 ret = IRQ_HANDLED;
9961064 }
@@ -1020,8 +1088,8 @@ done: · 23 unmodified lines
10201088 }
10211089
10221090 static int mma8452_reg_access_dbg(struct iio_dev *indio_dev,
1023− unsigned reg, unsigned writeval,
1024− unsigned *readval)
1091+ unsigned int reg, unsigned int writeval,
1092+ unsigned int *readval)
10251093 {
10261094 int ret;
10271095 struct mma8452_data *data = iio_priv(indio_dev);
@@ -1222,96 +1290,87 @@ static const struct mma_chip_info mma_chip_info_table[] = { · 194 unmodified lines
12221290 * g * N * 1000000 / 2048 for N = 2, 4, 8 and g=9.80665
12231291 */
12241292 .mma_scales = { {0, 2394}, {0, 4788}, {0, 9577} },
1225− .ev_cfg = MMA8452_TRANSIENT_CFG,
1226− .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
1227− .ev_cfg_chan_shift = 1,
1228− .ev_src = MMA8452_TRANSIENT_SRC,
1229− .ev_src_xe = MMA8452_TRANSIENT_SRC_XTRANSE,
1230− .ev_src_ye = MMA8452_TRANSIENT_SRC_YTRANSE,
1231− .ev_src_ze = MMA8452_TRANSIENT_SRC_ZTRANSE,
1232− .ev_ths = MMA8452_TRANSIENT_THS,
1233− .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
1234− .ev_count = MMA8452_TRANSIENT_COUNT,
1293+ /*
1294+ * Although we enable the interrupt sources once and for
1295+ * all here the event detection itself is not enabled until
1296+ * userspace asks for it by mma8452_write_event_config()
1297+ */
1298+ .all_events = MMA8452_INT_DRDY |
1299+ MMA8452_INT_TRANS |
1300+ MMA8452_INT_FF_MT,
1301+ .enabled_events = MMA8452_INT_TRANS |
1302+ MMA8452_INT_FF_MT,
12351303 },
12361304 [mma8452] = {
12371305 .chip_id = MMA8452_DEVICE_ID,
12381306 .channels = mma8452_channels,
12391307 .num_channels = ARRAY_SIZE(mma8452_channels),
12401308 .mma_scales = { {0, 9577}, {0, 19154}, {0, 38307} },
1241− .ev_cfg = MMA8452_TRANSIENT_CFG,
1242− .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
1243− .ev_cfg_chan_shift = 1,
1244− .ev_src = MMA8452_TRANSIENT_SRC,
1245− .ev_src_xe = MMA8452_TRANSIENT_SRC_XTRANSE,
1246− .ev_src_ye = MMA8452_TRANSIENT_SRC_YTRANSE,
1247− .ev_src_ze = MMA8452_TRANSIENT_SRC_ZTRANSE,
1248− .ev_ths = MMA8452_TRANSIENT_THS,
1249− .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
1250− .ev_count = MMA8452_TRANSIENT_COUNT,
1309+ /*
1310+ * Although we enable the interrupt sources once and for
1311+ * all here the event detection itself is not enabled until
1312+ * userspace asks for it by mma8452_write_event_config()
1313+ */
1314+ .all_events = MMA8452_INT_DRDY |
1315+ MMA8452_INT_TRANS |
1316+ MMA8452_INT_FF_MT,
1317+ .enabled_events = MMA8452_INT_TRANS |
1318+ MMA8452_INT_FF_MT,
12511319 },
12521320 [mma8453] = {
12531321 .chip_id = MMA8453_DEVICE_ID,
12541322 .channels = mma8453_channels,
12551323 .num_channels = ARRAY_SIZE(mma8453_channels),
12561324 .mma_scales = { {0, 38307}, {0, 76614}, {0, 153228} },
1257− .ev_cfg = MMA8452_TRANSIENT_CFG,
1258− .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
1259− .ev_cfg_chan_shift = 1,
1260− .ev_src = MMA8452_TRANSIENT_SRC,
1261− .ev_src_xe = MMA8452_TRANSIENT_SRC_XTRANSE,
1262− .ev_src_ye = MMA8452_TRANSIENT_SRC_YTRANSE,
1263− .ev_src_ze = MMA8452_TRANSIENT_SRC_ZTRANSE,
1264− .ev_ths = MMA8452_TRANSIENT_THS,
1265− .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
1266− .ev_count = MMA8452_TRANSIENT_COUNT,
1325+ /*
1326+ * Although we enable the interrupt sources once and for
1327+ * all here the event detection itself is not enabled until
1328+ * userspace asks for it by mma8452_write_event_config()
1329+ */
1330+ .all_events = MMA8452_INT_DRDY |
1331+ MMA8452_INT_TRANS |
1332+ MMA8452_INT_FF_MT,
1333+ .enabled_events = MMA8452_INT_TRANS |
1334+ MMA8452_INT_FF_MT,
12671335 },
12681336 [mma8652] = {
12691337 .chip_id = MMA8652_DEVICE_ID,
12701338 .channels = mma8652_channels,
12711339 .num_channels = ARRAY_SIZE(mma8652_channels),
12721340 .mma_scales = { {0, 9577}, {0, 19154}, {0, 38307} },
1273− .ev_cfg = MMA8452_FF_MT_CFG,
1274− .ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
1275− .ev_cfg_chan_shift = 3,
1276− .ev_src = MMA8452_FF_MT_SRC,
1277− .ev_src_xe = MMA8452_FF_MT_SRC_XHE,
1278− .ev_src_ye = MMA8452_FF_MT_SRC_YHE,
1279− .ev_src_ze = MMA8452_FF_MT_SRC_ZHE,
1280− .ev_ths = MMA8452_FF_MT_THS,
1281− .ev_ths_mask = MMA8452_FF_MT_THS_MASK,
1282− .ev_count = MMA8452_FF_MT_COUNT,
1341+ .all_events = MMA8452_INT_DRDY |
1342+ MMA8452_INT_FF_MT,
1343+ .enabled_events = MMA8452_INT_FF_MT,
12831344 },
12841345 [mma8653] = {
12851346 .chip_id = MMA8653_DEVICE_ID,
12861347 .channels = mma8653_channels,
12871348 .num_channels = ARRAY_SIZE(mma8653_channels),
12881349 .mma_scales = { {0, 38307}, {0, 76614}, {0, 153228} },
1289− .ev_cfg = MMA8452_FF_MT_CFG,
1290− .ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
1291− .ev_cfg_chan_shift = 3,
1292− .ev_src = MMA8452_FF_MT_SRC,
1293− .ev_src_xe = MMA8452_FF_MT_SRC_XHE,
1294− .ev_src_ye = MMA8452_FF_MT_SRC_YHE,
1295− .ev_src_ze = MMA8452_FF_MT_SRC_ZHE,
1296− .ev_ths = MMA8452_FF_MT_THS,
1297− .ev_ths_mask = MMA8452_FF_MT_THS_MASK,
1298− .ev_count = MMA8452_FF_MT_COUNT,
1350+ /*
1351+ * Although we enable the interrupt sources once and for
1352+ * all here the event detection itself is not enabled until
1353+ * userspace asks for it by mma8452_write_event_config()
1354+ */
1355+ .all_events = MMA8452_INT_DRDY |
1356+ MMA8452_INT_FF_MT,
1357+ .enabled_events = MMA8452_INT_FF_MT,
12991358 },
13001359 [fxls8471] = {
13011360 .chip_id = FXLS8471_DEVICE_ID,
13021361 .channels = mma8451_channels,
13031362 .num_channels = ARRAY_SIZE(mma8451_channels),
13041363 .mma_scales = { {0, 2394}, {0, 4788}, {0, 9577} },
1305− .ev_cfg = MMA8452_TRANSIENT_CFG,
1306− .ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
1307− .ev_cfg_chan_shift = 1,
1308− .ev_src = MMA8452_TRANSIENT_SRC,
1309− .ev_src_xe = MMA8452_TRANSIENT_SRC_XTRANSE,
1310− .ev_src_ye = MMA8452_TRANSIENT_SRC_YTRANSE,
1311− .ev_src_ze = MMA8452_TRANSIENT_SRC_ZTRANSE,
1312− .ev_ths = MMA8452_TRANSIENT_THS,
1313− .ev_ths_mask = MMA8452_TRANSIENT_THS_MASK,
1314− .ev_count = MMA8452_TRANSIENT_COUNT,
1364+ /*
1365+ * Although we enable the interrupt sources once and for
1366+ * all here the event detection itself is not enabled until
1367+ * userspace asks for it by mma8452_write_event_config()
1368+ */
1369+ .all_events = MMA8452_INT_DRDY |
1370+ MMA8452_INT_TRANS |
1371+ MMA8452_INT_FF_MT,
1372+ .enabled_events = MMA8452_INT_TRANS |
1373+ MMA8452_INT_FF_MT,
13151374 },
13161375 };
13171376
@@ -1332,12 +1391,11 @@ static const struct iio_info mma8452_info = { · 14 unmodified lines
13321391 .read_raw = &mma8452_read_raw,
13331392 .write_raw = &mma8452_write_raw,
13341393 .event_attrs = &mma8452_event_attribute_group,
1335− .read_event_value = &mma8452_read_thresh,
1336− .write_event_value = &mma8452_write_thresh,
1394+ .read_event_value = &mma8452_read_event_value,
1395+ .write_event_value = &mma8452_write_event_value,
13371396 .read_event_config = &mma8452_read_event_config,
13381397 .write_event_config = &mma8452_write_event_config,
13391398 .debugfs_reg_access = &mma8452_reg_access_dbg,
1340− .driver_module = THIS_MODULE,
13411399 };
13421400
13431401 static const unsigned long mma8452_scan_masks[] = {0x7, 0};
@@ -1368,7 +1426,6 @@ static int mma8452_data_rdy_trigger_set_state(struct iio_trigger *trig, · 24 unmodified lines
13681426 static const struct iio_trigger_ops mma8452_trigger_ops = {
13691427 .set_trigger_state = mma8452_data_rdy_trigger_set_state,
13701428 .validate_device = iio_trigger_validate_own_device,
1371− .owner = THIS_MODULE,
13721429 };
13731430
13741431 static int mma8452_trigger_setup(struct iio_dev *indio_dev)
@@ -1509,16 +1566,6 @@ static int mma8452_probe(struct i2c_client *client, · 134 unmodified lines
15091566 return ret;
15101567
15111568 if (client->irq) {
1512− /*
1513− * Although we enable the interrupt sources once and for
1514− * all here the event detection itself is not enabled until
1515− * userspace asks for it by mma8452_write_event_config()
1516− */
1517− int supported_interrupts = MMA8452_INT_DRDY |
1518− MMA8452_INT_TRANS |
1519− MMA8452_INT_FF_MT;
1520− int enabled_interrupts = MMA8452_INT_TRANS |
1521− MMA8452_INT_FF_MT;
15221569 int irq2;
15231570
15241571 irq2 = of_irq_get_byname(client->dev.of_node, "INT2");
@@ -1527,8 +1574,8 @@ static int mma8452_probe(struct i2c_client *client, · 2 unmodified lines
15271574 dev_dbg(&client->dev, "using interrupt line INT2\n");
15281575 } else {
15291576 ret = i2c_smbus_write_byte_data(client,
1530− MMA8452_CTRL_REG5,
1531− supported_interrupts);
1577+ MMA8452_CTRL_REG5,
1578+ data->chip_info->all_events);
15321579 if (ret < 0)
15331580 return ret;
15341581
@@ -1536,8 +1583,8 @@ static int mma8452_probe(struct i2c_client *client, · 1 unmodified line
15361583 }
15371584
15381585 ret = i2c_smbus_write_byte_data(client,
1539− MMA8452_CTRL_REG4,
1540− enabled_interrupts);
1586+ MMA8452_CTRL_REG4,
1587+ data->chip_info->enabled_events);
15411588 if (ret < 0)
15421589 return ret;
15431590
drivers/iio/accel/mma9551.c+0−1
@@ -332,7 +332,6 @@ static const struct iio_chan_spec mma9551_channels[] = { · 331 unmodified lines
332332 };
333333
334334 static const struct iio_info mma9551_info = {
335− .driver_module = THIS_MODULE,
336335 .read_raw = mma9551_read_raw,
337336 .read_event_config = mma9551_read_event_config,
338337 .write_event_config = mma9551_write_event_config,
drivers/iio/accel/mma9553.c+0−1
@@ -987,7 +987,6 @@ static const struct iio_chan_spec mma9553_channels[] = { · 986 unmodified lines
987987 };
988988
989989 static const struct iio_info mma9553_info = {
990− .driver_module = THIS_MODULE,
991990 .read_raw = mma9553_read_raw,
992991 .write_raw = mma9553_write_raw,
993992 .read_event_config = mma9553_read_event_config,
drivers/iio/accel/mxc4005.c+0−2
@@ -264,7 +264,6 @@ static int mxc4005_write_raw(struct iio_dev *indio_dev, · 263 unmodified lines
264264 }
265265
266266 static const struct iio_info mxc4005_info = {
267− .driver_module = THIS_MODULE,
268267 .read_raw = mxc4005_read_raw,
269268 .write_raw = mxc4005_write_raw,
270269 .attrs = &mxc4005_attrs_group,
@@ -376,7 +375,6 @@ static int mxc4005_trigger_try_reen(struct iio_trigger *trig) · 105 unmodified lines
376375 static const struct iio_trigger_ops mxc4005_trigger_ops = {
377376 .set_trigger_state = mxc4005_set_trigger_state,
378377 .try_reenable = mxc4005_trigger_try_reen,
379− .owner = THIS_MODULE,
380378 };
381379
382380 static int mxc4005_chip_init(struct mxc4005_data *data)
drivers/iio/accel/mxc6255.c+0−1
@@ -78,7 +78,6 @@ static int mxc6255_read_raw(struct iio_dev *indio_dev, · 77 unmodified lines
7878 }
7979
8080 static const struct iio_info mxc6255_info = {
81− .driver_module = THIS_MODULE,
8281 .read_raw = mxc6255_read_raw,
8382 };
8483
drivers/iio/accel/sca3000.c+0−1
@@ -1454,7 +1454,6 @@ static const struct iio_info sca3000_info = { · 1453 unmodified lines
14541454 .write_event_value = &sca3000_write_event_value,
14551455 .read_event_config = &sca3000_read_event_config,
14561456 .write_event_config = &sca3000_write_event_config,
1457− .driver_module = THIS_MODULE,
14581457 };
14591458
14601459 static int sca3000_probe(struct spi_device *spi)
drivers/iio/accel/st_accel.h+4−0
@@ -32,6 +32,8 @@ enum st_accel_type { · 31 unmodified lines
3232 H3LIS331DL,
3333 LIS331DL,
3434 LIS3LV02DL,
35+ LIS2DW12,
36+ LIS3DHH,
3537 ST_ACCEL_MAX,
3638 };
3739
@@ -52,6 +54,8 @@ enum st_accel_type { · 14 unmodified lines
5254 #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel"
5355 #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq"
5456 #define LNG2DM_ACCEL_DEV_NAME "lng2dm"
57+#define LIS2DW12_ACCEL_DEV_NAME "lis2dw12"
58+#define LIS3DHH_ACCEL_DEV_NAME "lis3dhh"
5559
5660 /**
5761 * struct st_sensors_platform_data - default accel platform data
drivers/iio/accel/st_accel_core.c+213−35
@@ -159,12 +159,16 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 158 unmodified lines
159159 .mask = 0x80,
160160 },
161161 .drdy_irq = {
162− .addr = 0x22,
163− .mask_int1 = 0x10,
164− .mask_int2 = 0x00,
162+ .int1 = {
163+ .addr = 0x22,
164+ .mask = 0x10,
165+ },
165166 .addr_ihl = 0x25,
166167 .mask_ihl = 0x02,
167− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
168+ .stat_drdy = {
169+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
170+ .mask = 0x07,
171+ },
168172 },
169173 .sim = {
170174 .addr = 0x23,
@@ -229,14 +233,24 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 58 unmodified lines
229233 .mask = 0x80,
230234 },
231235 .drdy_irq = {
232− .addr = 0x22,
233− .mask_int1 = 0x02,
234− .mask_int2 = 0x10,
236+ .int1 = {
237+ .addr = 0x22,
238+ .mask = 0x02,
239+ .addr_od = 0x22,
240+ .mask_od = 0x40,
241+ },
242+ .int2 = {
243+ .addr = 0x22,
244+ .mask = 0x10,
245+ .addr_od = 0x22,
246+ .mask_od = 0x40,
247+ },
235248 .addr_ihl = 0x22,
236249 .mask_ihl = 0x80,
237− .addr_od = 0x22,
238− .mask_od = 0x40,
239− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
250+ .stat_drdy = {
251+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
252+ .mask = 0x07,
253+ },
240254 },
241255 .sim = {
242256 .addr = 0x23,
@@ -313,12 +327,16 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 70 unmodified lines
313327 .mask = 0x08,
314328 },
315329 .drdy_irq = {
316− .addr = 0x23,
317− .mask_int1 = 0x80,
318− .mask_int2 = 0x00,
330+ .int1 = {
331+ .addr = 0x23,
332+ .mask = 0x80,
333+ },
319334 .addr_ihl = 0x23,
320335 .mask_ihl = 0x40,
321− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
336+ .stat_drdy = {
337+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
338+ .mask = 0x07,
339+ },
322340 .ig1 = {
323341 .en_addr = 0x23,
324342 .en_mask = 0x08,
@@ -387,9 +405,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 62 unmodified lines
387405 .mask = 0x01,
388406 },
389407 .drdy_irq = {
390− .addr = 0x21,
391− .mask_int1 = 0x04,
392− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
408+ .int1 = {
409+ .addr = 0x21,
410+ .mask = 0x04,
411+ },
412+ .stat_drdy = {
413+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
414+ .mask = 0x07,
415+ },
393416 },
394417 .sim = {
395418 .addr = 0x21,
@@ -444,14 +467,24 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 48 unmodified lines
444467 },
445468 },
446469 .drdy_irq = {
447− .addr = 0x22,
448− .mask_int1 = 0x04,
449− .mask_int2 = 0x20,
470+ .int1 = {
471+ .addr = 0x22,
472+ .mask = 0x04,
473+ .addr_od = 0x22,
474+ .mask_od = 0x40,
475+ },
476+ .int2 = {
477+ .addr = 0x22,
478+ .mask = 0x20,
479+ .addr_od = 0x22,
480+ .mask_od = 0x40,
481+ },
450482 .addr_ihl = 0x22,
451483 .mask_ihl = 0x80,
452− .addr_od = 0x22,
453− .mask_od = 0x40,
454− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
484+ .stat_drdy = {
485+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
486+ .mask = 0x07,
487+ },
455488 },
456489 .sim = {
457490 .addr = 0x21,
@@ -513,9 +546,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 55 unmodified lines
513546 .mask = 0x80,
514547 },
515548 .drdy_irq = {
516− .addr = 0x22,
517− .mask_int1 = 0x02,
518− .mask_int2 = 0x10,
549+ .int1 = {
550+ .addr = 0x22,
551+ .mask = 0x02,
552+ },
553+ .int2 = {
554+ .addr = 0x22,
555+ .mask = 0x10,
556+ },
519557 .addr_ihl = 0x22,
520558 .mask_ihl = 0x80,
521559 },
@@ -567,9 +605,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 45 unmodified lines
567605 .bdu = {
568606 },
569607 .drdy_irq = {
570− .addr = 0x21,
571− .mask_int1 = 0x04,
572− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
608+ .int1 = {
609+ .addr = 0x21,
610+ .mask = 0x04,
611+ },
612+ .stat_drdy = {
613+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
614+ .mask = 0x07,
615+ },
573616 },
574617 .sim = {
575618 .addr = 0x21,
@@ -635,12 +678,16 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 59 unmodified lines
635678 },
636679 },
637680 .drdy_irq = {
638− .addr = 0x22,
639− .mask_int1 = 0x10,
640− .mask_int2 = 0x00,
681+ .int1 = {
682+ .addr = 0x22,
683+ .mask = 0x10,
684+ },
641685 .addr_ihl = 0x25,
642686 .mask_ihl = 0x02,
643− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
687+ .stat_drdy = {
688+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
689+ .mask = 0x07,
690+ },
644691 },
645692 .sim = {
646693 .addr = 0x23,
@@ -649,6 +696,139 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { · 2 unmodified lines
649696 .multi_read_bit = true,
650697 .bootime = 2,
651698 },
699+ {
700+ .wai = 0x44,
701+ .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
702+ .sensors_supported = {
703+ [0] = LIS2DW12_ACCEL_DEV_NAME,
704+ },
705+ .ch = (struct iio_chan_spec *)st_accel_12bit_channels,
706+ .odr = {
707+ .addr = 0x20,
708+ .mask = 0xf0,
709+ .odr_avl = {
710+ { .hz = 1, .value = 0x01, },
711+ { .hz = 12, .value = 0x02, },
712+ { .hz = 25, .value = 0x03, },
713+ { .hz = 50, .value = 0x04, },
714+ { .hz = 100, .value = 0x05, },
715+ { .hz = 200, .value = 0x06, },
716+ },
717+ },
718+ .pw = {
719+ .addr = 0x20,
720+ .mask = 0xf0,
721+ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
722+ },
723+ .fs = {
724+ .addr = 0x25,
725+ .mask = 0x30,
726+ .fs_avl = {
727+ [0] = {
728+ .num = ST_ACCEL_FS_AVL_2G,
729+ .value = 0x00,
730+ .gain = IIO_G_TO_M_S_2(976),
731+ },
732+ [1] = {
733+ .num = ST_ACCEL_FS_AVL_4G,
734+ .value = 0x01,
735+ .gain = IIO_G_TO_M_S_2(1952),
736+ },
737+ [2] = {
738+ .num = ST_ACCEL_FS_AVL_8G,
739+ .value = 0x02,
740+ .gain = IIO_G_TO_M_S_2(3904),
741+ },
742+ [3] = {
743+ .num = ST_ACCEL_FS_AVL_16G,
744+ .value = 0x03,
745+ .gain = IIO_G_TO_M_S_2(7808),
746+ },
747+ },
748+ },
749+ .bdu = {
750+ .addr = 0x21,
751+ .mask = 0x08,
752+ },
753+ .drdy_irq = {
754+ .int1 = {
755+ .addr = 0x23,
756+ .mask = 0x01,
757+ .addr_od = 0x22,
758+ .mask_od = 0x20,
759+ },
760+ .int2 = {
761+ .addr = 0x24,
762+ .mask = 0x01,
763+ .addr_od = 0x22,
764+ .mask_od = 0x20,
765+ },
766+ .addr_ihl = 0x22,
767+ .mask_ihl = 0x08,
768+ .stat_drdy = {
769+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
770+ .mask = 0x01,
771+ },
772+ },
773+ .sim = {
774+ .addr = 0x21,
775+ .value = BIT(0),
776+ },
777+ .multi_read_bit = false,
778+ .bootime = 2,
779+ },
780+ {
781+ .wai = 0x11,
782+ .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
783+ .sensors_supported = {
784+ [0] = LIS3DHH_ACCEL_DEV_NAME,
785+ },
786+ .ch = (struct iio_chan_spec *)st_accel_16bit_channels,
787+ .odr = {
788+ /* just ODR = 1100Hz available */
789+ .odr_avl = {
790+ { .hz = 1100, .value = 0x00, },
791+ },
792+ },
793+ .pw = {
794+ .addr = 0x20,
795+ .mask = 0x80,
796+ .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
797+ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
798+ },
799+ .fs = {
800+ .fs_avl = {
801+ [0] = {
802+ .num = ST_ACCEL_FS_AVL_2G,
803+ .gain = IIO_G_TO_M_S_2(76),
804+ },
805+ },
806+ },
807+ .bdu = {
808+ .addr = 0x20,
809+ .mask = 0x01,
810+ },
811+ .drdy_irq = {
812+ .int1 = {
813+ .addr = 0x21,
814+ .mask = 0x80,
815+ .addr_od = 0x23,
816+ .mask_od = 0x04,
817+ },
818+ .int2 = {
819+ .addr = 0x22,
820+ .mask = 0x80,
821+ .addr_od = 0x23,
822+ .mask_od = 0x08,
823+ },
824+ .stat_drdy = {
825+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
826+ .mask = 0x07,
827+ },
828+ },
829+ .multi_read_bit = false,
830+ .bootime = 2,
831+ },
652832 };
653833
654834 static int st_accel_read_raw(struct iio_dev *indio_dev,
@@ -721,7 +901,6 @@ static const struct attribute_group st_accel_attribute_group = { · 66 unmodified lines
721901 };
722902
723903 static const struct iio_info accel_info = {
724− .driver_module = THIS_MODULE,
725904 .attrs = &st_accel_attribute_group,
726905 .read_raw = &st_accel_read_raw,
727906 .write_raw = &st_accel_write_raw,
@@ -730,7 +909,6 @@ static const struct iio_info accel_info = { · 2 unmodified lines
730909
731910 #ifdef CONFIG_IIO_TRIGGER
732911 static const struct iio_trigger_ops st_accel_trigger_ops = {
733− .owner = THIS_MODULE,
734912 .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE,
735913 .validate_device = st_sensors_validate_device,
736914 };
drivers/iio/accel/st_accel_i2c.c+5−0
@@ -94,6 +94,10 @@ static const struct of_device_id st_accel_of_match[] = { · 93 unmodified lines
9494 .compatible = "st,lng2dm-accel",
9595 .data = LNG2DM_ACCEL_DEV_NAME,
9696 },
97+ {
98+ .compatible = "st,lis2dw12",
99+ .data = LIS2DW12_ACCEL_DEV_NAME,
100+ },
97101 {},
98102 };
99103 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -129,6 +133,7 @@ static const struct i2c_device_id st_accel_id_table[] = { · 29 unmodified lines
129133 { H3LIS331DL_ACCEL_DEV_NAME, H3LIS331DL },
130134 { LIS331DL_ACCEL_DEV_NAME, LIS331DL },
131135 { LIS3LV02DL_ACCEL_DEV_NAME, LIS3LV02DL },
136+ { LIS2DW12_ACCEL_DEV_NAME, LIS2DW12 },
132137 {},
133138 };
134139 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
drivers/iio/accel/st_accel_spi.c+10−0
@@ -82,6 +82,14 @@ static const struct of_device_id st_accel_of_match[] = { · 81 unmodified lines
8282 .compatible = "st,lis331dl-accel",
8383 .data = LIS331DL_ACCEL_DEV_NAME,
8484 },
85+ {
86+ .compatible = "st,lis2dw12",
87+ .data = LIS2DW12_ACCEL_DEV_NAME,
88+ },
89+ {
90+ .compatible = "st,lis3dhh",
91+ .data = LIS3DHH_ACCEL_DEV_NAME,
92+ },
8593 {}
8694 };
8795 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -133,6 +141,8 @@ static const struct spi_device_id st_accel_id_table[] = { · 45 unmodified lines
133141 { H3LIS331DL_ACCEL_DEV_NAME },
134142 { LIS331DL_ACCEL_DEV_NAME },
135143 { LIS3LV02DL_ACCEL_DEV_NAME },
144+ { LIS2DW12_ACCEL_DEV_NAME },
145+ { LIS3DHH_ACCEL_DEV_NAME },
136146 {},
137147 };
138148 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
drivers/iio/accel/stk8312.c+0−2
@@ -237,7 +237,6 @@ static int stk8312_data_rdy_trigger_set_state(struct iio_trigger *trig, · 236 unmodified lines
237237
238238 static const struct iio_trigger_ops stk8312_trigger_ops = {
239239 .set_trigger_state = stk8312_data_rdy_trigger_set_state,
240− .owner = THIS_MODULE,
241240 };
242241
243242 static int stk8312_set_sample_rate(struct stk8312_data *data, u8 rate)
@@ -421,7 +420,6 @@ static int stk8312_write_raw(struct iio_dev *indio_dev, · 177 unmodified lines
421420 }
422421
423422 static const struct iio_info stk8312_info = {
424− .driver_module = THIS_MODULE,
425423 .read_raw = stk8312_read_raw,
426424 .write_raw = stk8312_write_raw,
427425 .attrs = &stk8312_attribute_group,
drivers/iio/accel/stk8ba50.c+0−2
@@ -179,7 +179,6 @@ static int stk8ba50_data_rdy_trigger_set_state(struct iio_trigger *trig, · 178 unmodified lines
179179
180180 static const struct iio_trigger_ops stk8ba50_trigger_ops = {
181181 .set_trigger_state = stk8ba50_data_rdy_trigger_set_state,
182− .owner = THIS_MODULE,
183182 };
184183
185184 static int stk8ba50_set_power(struct stk8ba50_data *data, bool mode)
@@ -307,7 +306,6 @@ static int stk8ba50_write_raw(struct iio_dev *indio_dev, · 121 unmodified lines
307306 }
308307
309308 static const struct iio_info stk8ba50_info = {
310− .driver_module = THIS_MODULE,
311309 .read_raw = stk8ba50_read_raw,
312310 .write_raw = stk8ba50_write_raw,
313311 .attrs = &stk8ba50_attribute_group,
drivers/iio/adc/Kconfig+4−3
@@ -477,12 +477,13 @@ config MAX9611 · 476 unmodified lines
477477 called max9611.
478478
479479 config MCP320X
480− tristate "Microchip Technology MCP3x01/02/04/08"
480+ tristate "Microchip Technology MCP3x01/02/04/08 and MCP3550/1/3"
481481 depends on SPI
482482 help
483483 Say yes here to build support for Microchip Technology's
484484 MCP3001, MCP3002, MCP3004, MCP3008, MCP3201, MCP3202, MCP3204,
485− MCP3208 or MCP3301 analog to digital converter.
485+ MCP3208, MCP3301, MCP3550, MCP3551 and MCP3553 analog to digital
486+ converters.
486487
487488 This driver can also be built as a module. If so, the module will be
488489 called mcp320x.
@@ -595,7 +596,7 @@ config QCOM_SPMI_VADC · 106 unmodified lines
595596
596597 config RCAR_GYRO_ADC
597598 tristate "Renesas R-Car GyroADC driver"
598− depends on ARCH_RCAR_GEN2 || (ARM && COMPILE_TEST)
599+ depends on ARCH_RCAR_GEN2 || COMPILE_TEST
599600 help
600601 Say yes here to build support for the GyroADC found in Renesas
601602 R-Car Gen2 SoCs. This block is a simple SPI offload engine for
drivers/iio/adc/ad7266.c+0−1
@@ -280,7 +280,6 @@ static AD7266_DECLARE_DIFF_CHANNELS_FIXED(u, 'u'); · 279 unmodified lines
280280 static const struct iio_info ad7266_info = {
281281 .read_raw = &ad7266_read_raw,
282282 .update_scan_mode = &ad7266_update_scan_mode,
283− .driver_module = THIS_MODULE,
284283 };
285284
286285 static const unsigned long ad7266_available_scan_masks[] = {
drivers/iio/adc/ad7291.c+0−1
@@ -461,7 +461,6 @@ static const struct iio_info ad7291_info = { · 460 unmodified lines
461461 .write_event_config = &ad7291_write_event_config,
462462 .read_event_value = &ad7291_read_event_value,
463463 .write_event_value = &ad7291_write_event_value,
464− .driver_module = THIS_MODULE,
465464 };
466465
467466 static int ad7291_probe(struct i2c_client *client,
drivers/iio/adc/ad7298.c+0−1
@@ -280,7 +280,6 @@ static int ad7298_read_raw(struct iio_dev *indio_dev, · 279 unmodified lines
280280 static const struct iio_info ad7298_info = {
281281 .read_raw = &ad7298_read_raw,
282282 .update_scan_mode = ad7298_update_scan_mode,
283− .driver_module = THIS_MODULE,
284283 };
285284
286285 static int ad7298_probe(struct spi_device *spi)
drivers/iio/adc/ad7476.c+0−1
@@ -195,7 +195,6 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { · 194 unmodified lines
195195 };
196196
197197 static const struct iio_info ad7476_info = {
198− .driver_module = THIS_MODULE,
199198 .read_raw = &ad7476_read_raw,
200199 };
201200
drivers/iio/adc/ad7766.c+0−2
@@ -185,7 +185,6 @@ static const struct iio_buffer_setup_ops ad7766_buffer_setup_ops = { · 184 unmodified lines
185185 };
186186
187187 static const struct iio_info ad7766_info = {
188− .driver_module = THIS_MODULE,
189188 .read_raw = &ad7766_read_raw,
190189 };
191190
@@ -208,7 +207,6 @@ static int ad7766_set_trigger_state(struct iio_trigger *trig, bool enable) · 16 unmodified lines
208207 }
209208
210209 static const struct iio_trigger_ops ad7766_trigger_ops = {
211− .owner = THIS_MODULE,
212210 .set_trigger_state = ad7766_set_trigger_state,
213211 .validate_device = iio_trigger_validate_own_device,
214212 };
drivers/iio/adc/ad7791.c+0−2
@@ -308,13 +308,11 @@ static const struct iio_info ad7791_info = { · 307 unmodified lines
308308 .read_raw = &ad7791_read_raw,
309309 .attrs = &ad7791_attribute_group,
310310 .validate_trigger = ad_sd_validate_trigger,
311− .driver_module = THIS_MODULE,
312311 };
313312
314313 static const struct iio_info ad7791_no_filter_info = {
315314 .read_raw = &ad7791_read_raw,
316315 .validate_trigger = ad_sd_validate_trigger,
317− .driver_module = THIS_MODULE,
318316 };
319317
320318 static int ad7791_setup(struct ad7791_state *st,
drivers/iio/adc/ad7793.c+0−2
@@ -563,7 +563,6 @@ static const struct iio_info ad7793_info = { · 562 unmodified lines
563563 .write_raw_get_fmt = &ad7793_write_raw_get_fmt,
564564 .attrs = &ad7793_attribute_group,
565565 .validate_trigger = ad_sd_validate_trigger,
566− .driver_module = THIS_MODULE,
567566 };
568567
569568 static const struct iio_info ad7797_info = {
@@ -572,7 +571,6 @@ static const struct iio_info ad7797_info = { · 2 unmodified lines
572571 .write_raw_get_fmt = &ad7793_write_raw_get_fmt,
573572 .attrs = &ad7793_attribute_group,
574573 .validate_trigger = ad_sd_validate_trigger,
575− .driver_module = THIS_MODULE,
576574 };
577575
578576 #define DECLARE_AD7793_CHANNELS(_name, _b, _sb, _s) \
drivers/iio/adc/ad7887.c+0−1
@@ -229,7 +229,6 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { · 228 unmodified lines
229229
230230 static const struct iio_info ad7887_info = {
231231 .read_raw = &ad7887_read_raw,
232− .driver_module = THIS_MODULE,
233232 };
234233
235234 static int ad7887_probe(struct spi_device *spi)
drivers/iio/adc/ad7923.c+0−1
@@ -262,7 +262,6 @@ static int ad7923_read_raw(struct iio_dev *indio_dev, · 261 unmodified lines
262262 static const struct iio_info ad7923_info = {
263263 .read_raw = &ad7923_read_raw,
264264 .update_scan_mode = ad7923_update_scan_mode,
265− .driver_module = THIS_MODULE,
266265 };
267266
268267 static int ad7923_probe(struct spi_device *spi)
drivers/iio/adc/ad799x.c+0−3
@@ -526,13 +526,11 @@ static const struct attribute_group ad799x_event_attrs_group = { · 525 unmodified lines
526526
527527 static const struct iio_info ad7991_info = {
528528 .read_raw = &ad799x_read_raw,
529− .driver_module = THIS_MODULE,
530529 .update_scan_mode = ad799x_update_scan_mode,
531530 };
532531
533532 static const struct iio_info ad7993_4_7_8_noirq_info = {
534533 .read_raw = &ad799x_read_raw,
535− .driver_module = THIS_MODULE,
536534 .update_scan_mode = ad799x_update_scan_mode,
537535 };
538536
@@ -543,7 +541,6 @@ static const struct iio_info ad7993_4_7_8_irq_info = { · 4 unmodified lines
543541 .write_event_config = &ad799x_write_event_config,
544542 .read_event_value = &ad799x_read_event_value,
545543 .write_event_value = &ad799x_write_event_value,
546− .driver_module = THIS_MODULE,
547544 .update_scan_mode = ad799x_update_scan_mode,
548545 };
549546
drivers/iio/adc/ad_sigma_delta.c+0−1
@@ -463,7 +463,6 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig) · 462 unmodified lines
463463 EXPORT_SYMBOL_GPL(ad_sd_validate_trigger);
464464
465465 static const struct iio_trigger_ops ad_sd_trigger_ops = {
466− .owner = THIS_MODULE,
467466 };
468467
469468 static int ad_sd_probe_trigger(struct iio_dev *indio_dev)
drivers/iio/adc/aspeed_adc.c+0−1
@@ -165,7 +165,6 @@ static int aspeed_adc_reg_access(struct iio_dev *indio_dev, · 164 unmodified lines
165165 }
166166
167167 static const struct iio_info aspeed_adc_iio_info = {
168− .driver_module = THIS_MODULE,
169168 .read_raw = aspeed_adc_read_raw,
170169 .write_raw = aspeed_adc_write_raw,
171170 .debugfs_reg_access = aspeed_adc_reg_access,
drivers/iio/adc/at91-sama5d2_adc.c+0−2
@@ -348,7 +348,6 @@ static int at91_adc_reenable_trigger(struct iio_trigger *trig) · 347 unmodified lines
348348 }
349349
350350 static const struct iio_trigger_ops at91_adc_trigger_ops = {
351− .owner = THIS_MODULE,
352351 .set_trigger_state = &at91_adc_configure_trigger,
353352 .try_reenable = &at91_adc_reenable_trigger,
354353 };
@@ -584,7 +583,6 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, · 229 unmodified lines
584583 static const struct iio_info at91_adc_info = {
585584 .read_raw = &at91_adc_read_raw,
586585 .write_raw = &at91_adc_write_raw,
587− .driver_module = THIS_MODULE,
588586 };
589587
590588 static void at91_adc_hw_init(struct at91_adc_state *st)
drivers/iio/adc/at91_adc.c+0−2
@@ -594,7 +594,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) · 593 unmodified lines
594594 }
595595
596596 static const struct iio_trigger_ops at91_adc_trigger_ops = {
597− .owner = THIS_MODULE,
598597 .set_trigger_state = &at91_adc_configure_trigger,
599598 };
600599
@@ -976,7 +975,6 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st, · 375 unmodified lines
976975 }
977976
978977 static const struct iio_info at91_adc_info = {
979− .driver_module = THIS_MODULE,
980978 .read_raw = &at91_adc_read_raw,
981979 };
982980
drivers/iio/adc/axp20x_adc.c+0−2
@@ -464,12 +464,10 @@ static int axp20x_write_raw(struct iio_dev *indio_dev, · 463 unmodified lines
464464 static const struct iio_info axp20x_adc_iio_info = {
465465 .read_raw = axp20x_read_raw,
466466 .write_raw = axp20x_write_raw,
467− .driver_module = THIS_MODULE,
468467 };
469468
470469 static const struct iio_info axp22x_adc_iio_info = {
471470 .read_raw = axp22x_read_raw,
472− .driver_module = THIS_MODULE,
473471 };
474472
475473 static int axp20x_adc_rate(int rate)
drivers/iio/adc/axp288_adc.c+0−1
@@ -183,7 +183,6 @@ static int axp288_adc_set_state(struct regmap *regmap) · 182 unmodified lines
183183
184184 static const struct iio_info axp288_adc_iio_info = {
185185 .read_raw = &axp288_adc_read_raw,
186− .driver_module = THIS_MODULE,
187186 };
188187
189188 static int axp288_adc_probe(struct platform_device *pdev)
drivers/iio/adc/bcm_iproc_adc.c+0−1
@@ -492,7 +492,6 @@ static int iproc_adc_read_raw(struct iio_dev *indio_dev, · 491 unmodified lines
492492
493493 static const struct iio_info iproc_adc_iio_info = {
494494 .read_raw = &iproc_adc_read_raw,
495− .driver_module = THIS_MODULE,
496495 };
497496
498497 #define IPROC_ADC_CHANNEL(_index, _id) { \
drivers/iio/adc/berlin2-adc.c+0−1
@@ -277,7 +277,6 @@ static irqreturn_t berlin2_adc_tsen_irq(int irq, void *private) · 276 unmodified lines
277277 }
278278
279279 static const struct iio_info berlin2_adc_info = {
280− .driver_module = THIS_MODULE,
281280 .read_raw = berlin2_adc_read_raw,
282281 };
283282
drivers/iio/adc/cc10001_adc.c+0−1
@@ -262,7 +262,6 @@ static int cc10001_update_scan_mode(struct iio_dev *indio_dev, · 261 unmodified lines
262262 }
263263
264264 static const struct iio_info cc10001_adc_info = {
265− .driver_module = THIS_MODULE,
266265 .read_raw = &cc10001_adc_read_raw,
267266 .update_scan_mode = &cc10001_update_scan_mode,
268267 };
drivers/iio/adc/cpcap-adc.c+0−1
@@ -932,7 +932,6 @@ err_unlock: · 931 unmodified lines
932932
933933 static const struct iio_info cpcap_adc_info = {
934934 .read_raw = &cpcap_adc_read,
935− .driver_module = THIS_MODULE,
936935 };
937936
938937 /*
drivers/iio/adc/da9150-gpadc.c+0−1
@@ -249,7 +249,6 @@ static int da9150_gpadc_read_raw(struct iio_dev *indio_dev, · 248 unmodified lines
249249
250250 static const struct iio_info da9150_gpadc_info = {
251251 .read_raw = &da9150_gpadc_read_raw,
252− .driver_module = THIS_MODULE,
253252 };
254253
255254 #define DA9150_GPADC_CHANNEL(_id, _hw_id, _type, chan_info, \
drivers/iio/adc/dln2-adc.c+0−6
@@ -479,7 +479,6 @@ static const struct iio_info dln2_adc_info = { · 478 unmodified lines
479479 .read_raw = dln2_adc_read_raw,
480480 .write_raw = dln2_adc_write_raw,
481481 .update_scan_mode = dln2_update_scan_mode,
482− .driver_module = THIS_MODULE,
483482 };
484483
485484 static irqreturn_t dln2_adc_trigger_h(int irq, void *p)
@@ -604,10 +603,6 @@ static void dln2_adc_event(struct platform_device *pdev, u16 echo, · 118 unmodified lines
604603 iio_trigger_poll(dln2->trig);
605604 }
606605
607−static const struct iio_trigger_ops dln2_adc_trigger_ops = {
608− .owner = THIS_MODULE,
609−};
610−
611606 static int dln2_adc_probe(struct platform_device *pdev)
612607 {
613608 struct device *dev = &pdev->dev;
@@ -665,7 +660,6 @@ static int dln2_adc_probe(struct platform_device *pdev) · 51 unmodified lines
665660 dev_err(dev, "failed to allocate trigger\n");
666661 return -ENOMEM;
667662 }
668− dln2->trig->ops = &dln2_adc_trigger_ops;
669663 iio_trigger_set_drvdata(dln2->trig, dln2);
670664 devm_iio_trigger_register(dev, dln2->trig);
671665 iio_trigger_set_immutable(indio_dev, dln2->trig);
drivers/iio/adc/envelope-detector.c+0−1
@@ -322,7 +322,6 @@ static const struct iio_chan_spec envelope_detector_iio_channel = { · 321 unmodified lines
322322
323323 static const struct iio_info envelope_detector_info = {
324324 .read_raw = &envelope_detector_read_raw,
325− .driver_module = THIS_MODULE,
326325 };
327326
328327 static int envelope_detector_probe(struct platform_device *pdev)
drivers/iio/adc/ep93xx_adc.c+0−1
@@ -150,7 +150,6 @@ static int ep93xx_read_raw(struct iio_dev *iiodev, · 149 unmodified lines
150150 }
151151
152152 static const struct iio_info ep93xx_adc_info = {
153− .driver_module = THIS_MODULE,
154153 .read_raw = ep93xx_read_raw,
155154 };
156155
drivers/iio/adc/exynos_adc.c+0−1
@@ -657,7 +657,6 @@ static int exynos_adc_reg_access(struct iio_dev *indio_dev, · 656 unmodified lines
657657 static const struct iio_info exynos_adc_iio_info = {
658658 .read_raw = &exynos_read_raw,
659659 .debugfs_reg_access = &exynos_adc_reg_access,
660− .driver_module = THIS_MODULE,
661660 };
662661
663662 #define ADC_CHANNEL(_index, _id) { \
drivers/iio/adc/hi8435.c+0−1
@@ -408,7 +408,6 @@ static const struct iio_chan_spec hi8435_channels[] = { · 407 unmodified lines
408408 };
409409
410410 static const struct iio_info hi8435_info = {
411− .driver_module = THIS_MODULE,
412411 .read_raw = hi8435_read_raw,
413412 .read_event_config = hi8435_read_event_config,
414413 .write_event_config = hi8435_write_event_config,
drivers/iio/adc/hx711.c+0−1
@@ -374,7 +374,6 @@ static const struct attribute_group hx711_attribute_group = { · 373 unmodified lines
374374 };
375375
376376 static const struct iio_info hx711_iio_info = {
377− .driver_module = THIS_MODULE,
378377 .read_raw = hx711_read_raw,
379378 .write_raw = hx711_write_raw,
380379 .write_raw_get_fmt = hx711_write_raw_get_fmt,
drivers/iio/adc/imx7d_adc.c+0−1
@@ -412,7 +412,6 @@ static int imx7d_adc_reg_access(struct iio_dev *indio_dev, · 411 unmodified lines
412412 }
413413
414414 static const struct iio_info imx7d_adc_iio_info = {
415− .driver_module = THIS_MODULE,
416415 .read_raw = &imx7d_adc_read_raw,
417416 .debugfs_reg_access = &imx7d_adc_reg_access,
418417 };
drivers/iio/adc/ina2xx-adc.c+9−11
@@ -123,7 +123,7 @@ struct ina2xx_chip_info { · 122 unmodified lines
123123 struct task_struct *task;
124124 const struct ina2xx_config *config;
125125 struct mutex state_lock;
126− unsigned int shunt_resistor;
126+ unsigned int shunt_resistor_uohm;
127127 int avg;
128128 int int_time_vbus; /* Bus voltage integration time uS */
129129 int int_time_vshunt; /* Shunt voltage integration time uS */
@@ -436,7 +436,7 @@ static ssize_t ina2xx_allow_async_readout_store(struct device *dev, · 306 unmodified lines
436436 /*
437437 * Set current LSB to 1mA, shunt is in uOhms
438438 * (equation 13 in datasheet). We hardcode a Current_LSB
439− * of 1.0 x10-6. The only remaining parameter is RShunt.
439+ * of 1.0 x10-3. The only remaining parameter is RShunt.
440440 * There is no need to expose the CALIBRATION register
441441 * to the user for now. But we need to reset this register
442442 * if the user updates RShunt after driver init, e.g upon
@@ -445,7 +445,7 @@ static ssize_t ina2xx_allow_async_readout_store(struct device *dev, · 2 unmodified lines
445445 static int ina2xx_set_calibration(struct ina2xx_chip_info *chip)
446446 {
447447 u16 regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor,
448− chip->shunt_resistor);
448+ chip->shunt_resistor_uohm);
449449
450450 return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval);
451451 }
@@ -455,7 +455,7 @@ static int set_shunt_resistor(struct ina2xx_chip_info *chip, unsigned int val) · 3 unmodified lines
455455 if (val <= 0 || val > chip->config->calibration_factor)
456456 return -EINVAL;
457457
458− chip->shunt_resistor = val;
458+ chip->shunt_resistor_uohm = val;
459459
460460 return 0;
461461 }
@@ -465,8 +465,9 @@ static ssize_t ina2xx_shunt_resistor_show(struct device *dev, · 3 unmodified lines
465465 char *buf)
466466 {
467467 struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev));
468+ int vals[2] = { chip->shunt_resistor_uohm, 1000000 };
468469
469− return sprintf(buf, "%d\n", chip->shunt_resistor);
470+ return iio_format_value(buf, IIO_VAL_FRACTIONAL, 1, vals);
470471 }
471472
472473 static ssize_t ina2xx_shunt_resistor_store(struct device *dev,
@@ -474,14 +475,13 @@ static ssize_t ina2xx_shunt_resistor_store(struct device *dev, · 1 unmodified line
474475 const char *buf, size_t len)
475476 {
476477 struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev));
477− unsigned long val;
478− int ret;
478+ int val, val_fract, ret;
479479
480− ret = kstrtoul((const char *) buf, 10, &val);
480+ ret = iio_str_to_fixpoint(buf, 100000, &val, &val_fract);
481481 if (ret)
482482 return ret;
483483
484− ret = set_shunt_resistor(chip, val);
484+ ret = set_shunt_resistor(chip, val * 1000000 + val_fract);
485485 if (ret)
486486 return ret;
487487
@@ -778,7 +778,6 @@ static const struct attribute_group ina226_attribute_group = { · 290 unmodified lines
778778 };
779779
780780 static const struct iio_info ina219_info = {
781− .driver_module = THIS_MODULE,
782781 .attrs = &ina219_attribute_group,
783782 .read_raw = ina2xx_read_raw,
784783 .write_raw = ina2xx_write_raw,
@@ -786,7 +785,6 @@ static const struct iio_info ina219_info = { · 1 unmodified line
786785 };
787786
788787 static const struct iio_info ina226_info = {
789− .driver_module = THIS_MODULE,
790788 .attrs = &ina226_attribute_group,
791789 .read_raw = ina2xx_read_raw,
792790 .write_raw = ina2xx_write_raw,
drivers/iio/adc/lp8788_adc.c+0−1
@@ -125,7 +125,6 @@ static int lp8788_adc_read_raw(struct iio_dev *indio_dev, · 124 unmodified lines
125125
126126 static const struct iio_info lp8788_adc_info = {
127127 .read_raw = &lp8788_adc_read_raw,
128− .driver_module = THIS_MODULE,
129128 };
130129
131130 #define LP8788_CHAN(_id, _type) { \
drivers/iio/adc/lpc18xx_adc.c+0−1
@@ -116,7 +116,6 @@ static int lpc18xx_adc_read_raw(struct iio_dev *indio_dev, · 115 unmodified lines
116116
117117 static const struct iio_info lpc18xx_adc_info = {
118118 .read_raw = lpc18xx_adc_read_raw,
119− .driver_module = THIS_MODULE,
120119 };
121120
122121 static int lpc18xx_adc_probe(struct platform_device *pdev)
drivers/iio/adc/lpc32xx_adc.c+0−1
@@ -104,7 +104,6 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, · 103 unmodified lines
104104
105105 static const struct iio_info lpc32xx_adc_iio_info = {
106106 .read_raw = &lpc32xx_read_raw,
107− .driver_module = THIS_MODULE,
108107 };
109108
110109 #define LPC32XX_ADC_CHANNEL(_index) { \
drivers/iio/adc/ltc2471.c+0−1
@@ -98,7 +98,6 @@ static const struct iio_chan_spec ltc2473_channel[] = { · 97 unmodified lines
9898
9999 static const struct iio_info ltc2471_info = {
100100 .read_raw = ltc2471_read_raw,
101− .driver_module = THIS_MODULE,
102101 };
103102
104103 static int ltc2471_i2c_probe(struct i2c_client *client,
drivers/iio/adc/ltc2485.c+0−1
@@ -90,7 +90,6 @@ static const struct iio_chan_spec ltc2485_channel[] = { · 89 unmodified lines
9090
9191 static const struct iio_info ltc2485_info = {
9292 .read_raw = ltc2485_read_raw,
93− .driver_module = THIS_MODULE,
9493 };
9594
9695 static int ltc2485_probe(struct i2c_client *client,
drivers/iio/adc/ltc2497.c+0−1
@@ -186,7 +186,6 @@ static const struct iio_chan_spec ltc2497_channel[] = { · 185 unmodified lines
186186
187187 static const struct iio_info ltc2497_info = {
188188 .read_raw = ltc2497_read_raw,
189− .driver_module = THIS_MODULE,
190189 };
191190
192191 static int ltc2497_probe(struct i2c_client *client,
drivers/iio/adc/max1027.c+0−2
@@ -381,13 +381,11 @@ static irqreturn_t max1027_trigger_handler(int irq, void *private) · 380 unmodified lines
381381 }
382382
383383 static const struct iio_trigger_ops max1027_trigger_ops = {
384− .owner = THIS_MODULE,
385384 .validate_device = &iio_trigger_validate_own_device,
386385 .set_trigger_state = &max1027_set_trigger_state,
387386 };
388387
389388 static const struct iio_info max1027_info = {
390− .driver_module = THIS_MODULE,
391389 .read_raw = &max1027_read_raw,
392390 .validate_trigger = &max1027_validate_trigger,
393391 .debugfs_reg_access = &max1027_debugfs_reg_access,
drivers/iio/adc/max11100.c+0−1
@@ -100,7 +100,6 @@ static int max11100_read_raw(struct iio_dev *indio_dev, · 99 unmodified lines
100100 }
101101
102102 static const struct iio_info max11100_info = {
103− .driver_module = THIS_MODULE,
104103 .read_raw = max11100_read_raw,
105104 };
106105
drivers/iio/adc/max1118.c+0−1
@@ -155,7 +155,6 @@ static int max1118_read_raw(struct iio_dev *indio_dev, · 154 unmodified lines
155155
156156 static const struct iio_info max1118_info = {
157157 .read_raw = max1118_read_raw,
158− .driver_module = THIS_MODULE,
159158 };
160159
161160 static irqreturn_t max1118_trigger_handler(int irq, void *p)
drivers/iio/adc/max1363.c+0−2
@@ -1029,7 +1029,6 @@ static int max1363_update_scan_mode(struct iio_dev *indio_dev, · 1028 unmodified lines
10291029
10301030 static const struct iio_info max1238_info = {
10311031 .read_raw = &max1363_read_raw,
1032− .driver_module = THIS_MODULE,
10331032 .update_scan_mode = &max1363_update_scan_mode,
10341033 };
10351034
@@ -1040,7 +1039,6 @@ static const struct iio_info max1363_info = { · 4 unmodified lines
10401039 .write_event_config = &max1363_write_event_config,
10411040 .read_raw = &max1363_read_raw,
10421041 .update_scan_mode = &max1363_update_scan_mode,
1043− .driver_module = THIS_MODULE,
10441042 .event_attrs = &max1363_event_attribute_group,
10451043 };
10461044
drivers/iio/adc/max9611.c+0−2
@@ -460,7 +460,6 @@ static const struct attribute_group max9611_attribute_group = { · 459 unmodified lines
460460 };
461461
462462 static const struct iio_info indio_info = {
463− .driver_module = THIS_MODULE,
464463 .read_raw = max9611_read_raw,
465464 .attrs = &max9611_attribute_group,
466465 };
@@ -573,7 +572,6 @@ static int max9611_probe(struct i2c_client *client, · 106 unmodified lines
573572 static struct i2c_driver max9611_driver = {
574573 .driver = {
575574 .name = DRIVER_NAME,
576− .owner = THIS_MODULE,
577575 .of_match_table = max9611_of_table,
578576 },
579577 .probe = max9611_probe,
drivers/iio/adc/mcp320x.c+156−79
@@ -19,6 +19,11 @@ · 18 unmodified lines
1919 * ------------
2020 * 13 bit converter
2121 * MCP3301
22+ * ------------
23+ * 22 bit converter
24+ * MCP3550
25+ * MCP3551
26+ * MCP3553
2227 *
2328 * Datasheet can be found here:
2429 * http://ww1.microchip.com/downloads/en/DeviceDoc/21293C.pdf mcp3001
@@ -28,6 +33,7 @@ · 3 unmodified lines
2833 * http://ww1.microchip.com/downloads/en/DeviceDoc/21034D.pdf mcp3202
2934 * http://ww1.microchip.com/downloads/en/DeviceDoc/21298c.pdf mcp3204/08
3035 * http://ww1.microchip.com/downloads/en/DeviceDoc/21700E.pdf mcp3301
36+ * http://ww1.microchip.com/downloads/en/DeviceDoc/21950D.pdf mcp3550/1/3
3137 *
3238 * This program is free software; you can redistribute it and/or modify
3339 * it under the terms of the GNU General Public License version 2 as
@@ -51,25 +57,45 @@ enum { · 17 unmodified lines
5157 mcp3204,
5258 mcp3208,
5359 mcp3301,
60+ mcp3550_50,
61+ mcp3550_60,
62+ mcp3551,
63+ mcp3553,
5464 };
5565
5666 struct mcp320x_chip_info {
5767 const struct iio_chan_spec *channels;
5868 unsigned int num_channels;
5969 unsigned int resolution;
70+ unsigned int conv_time; /* usec */
6071 };
6172
73+/**
74+ * struct mcp320x - Microchip SPI ADC instance
75+ * @spi: SPI slave (parent of the IIO device)
76+ * @msg: SPI message to select a channel and receive a value from the ADC
77+ * @transfer: SPI transfers used by @msg
78+ * @start_conv_msg: SPI message to start a conversion by briefly asserting CS
79+ * @start_conv_transfer: SPI transfer used by @start_conv_msg
80+ * @reg: regulator generating Vref
81+ * @lock: protects read sequences
82+ * @chip_info: ADC properties
83+ * @tx_buf: buffer for @transfer[0] (not used on single-channel converters)
84+ * @rx_buf: buffer for @transfer[1]
85+ */
6286 struct mcp320x {
6387 struct spi_device *spi;
6488 struct spi_message msg;
6589 struct spi_transfer transfer[2];
90+ struct spi_message start_conv_msg;
91+ struct spi_transfer start_conv_transfer;
6692
6793 struct regulator *reg;
6894 struct mutex lock;
6995 const struct mcp320x_chip_info *chip_info;
7096
7197 u8 tx_buf ____cacheline_aligned;
72− u8 rx_buf[2];
98+ u8 rx_buf[4];
7399 };
74100
75101 static int mcp320x_channel_to_tx_data(int device_index,
@@ -78,10 +104,6 @@ static int mcp320x_channel_to_tx_data(int device_index, · 2 unmodified lines
78104 int start_bit = 1;
79105
80106 switch (device_index) {
81− case mcp3001:
82− case mcp3201:
83− case mcp3301:
84− return 0;
85107 case mcp3002:
86108 case mcp3202:
87109 return ((start_bit << 4) | (!differential << 3) |
@@ -102,21 +124,24 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel, · 14 unmodified lines
102124 {
103125 int ret;
104126
105− adc->rx_buf[0] = 0;
106− adc->rx_buf[1] = 0;
107− adc->tx_buf = mcp320x_channel_to_tx_data(device_index,
108− channel, differential);
109−
110− if (device_index != mcp3001 && device_index != mcp3201 && device_index != mcp3301) {
111− ret = spi_sync(adc->spi, &adc->msg);
112− if (ret < 0)
113− return ret;
114− } else {
115− ret = spi_read(adc->spi, &adc->rx_buf, sizeof(adc->rx_buf));
127+ if (adc->chip_info->conv_time) {
128+ ret = spi_sync(adc->spi, &adc->start_conv_msg);
116129 if (ret < 0)
117130 return ret;
131+
132+ usleep_range(adc->chip_info->conv_time,
133+ adc->chip_info->conv_time + 100);
118134 }
119135
136+ memset(&adc->rx_buf, 0, sizeof(adc->rx_buf));
137+ if (adc->chip_info->num_channels > 1)
138+ adc->tx_buf = mcp320x_channel_to_tx_data(device_index, channel,
139+ differential);
140+
141+ ret = spi_sync(adc->spi, &adc->msg);
142+ if (ret < 0)
143+ return ret;
144+
120145 switch (device_index) {
121146 case mcp3001:
122147 *val = (adc->rx_buf[0] << 5 | adc->rx_buf[1] >> 3);
@@ -138,6 +163,31 @@ static int mcp320x_adc_conversion(struct mcp320x *adc, u8 channel, · 15 unmodified lines
138163 *val = sign_extend32((adc->rx_buf[0] & 0x1f) << 8
139164 | adc->rx_buf[1], 12);
140165 return 0;
166+ case mcp3550_50:
167+ case mcp3550_60:
168+ case mcp3551:
169+ case mcp3553: {
170+ u32 raw = be32_to_cpup((u32 *)adc->rx_buf);
171+
172+ if (!(adc->spi->mode & SPI_CPOL))
173+ raw <<= 1; /* strip Data Ready bit in SPI mode 0,0 */
174+
175+ /*
176+ * If the input is within -vref and vref, bit 21 is the sign.
177+ * Up to 12% overrange or underrange are allowed, in which case
178+ * bit 23 is the sign and bit 0 to 21 is the value.
179+ */
180+ raw >>= 8;
181+ if (raw & BIT(22) && raw & BIT(23))
182+ return -EIO; /* cannot have overrange AND underrange */
183+ else if (raw & BIT(22))
184+ raw &= ~BIT(22); /* overrange */
185+ else if (raw & BIT(23) || raw & BIT(21))
186+ raw |= GENMASK(31, 22); /* underrange or negative */
187+
188+ *val = (s32)raw;
189+ return 0;
190+ }
141191 default:
142192 return -EINVAL;
143193 }
@@ -248,7 +298,6 @@ static const struct iio_chan_spec mcp3208_channels[] = { · 104 unmodified lines
248298
249299 static const struct iio_info mcp320x_info = {
250300 .read_raw = mcp320x_read_raw,
251− .driver_module = THIS_MODULE,
252301 };
253302
254303 static const struct mcp320x_chip_info mcp320x_chip_infos[] = {
@@ -297,6 +346,31 @@ static const struct mcp320x_chip_info mcp320x_chip_infos[] = { · 42 unmodified lines
297346 .num_channels = ARRAY_SIZE(mcp3201_channels),
298347 .resolution = 13
299348 },
349+ [mcp3550_50] = {
350+ .channels = mcp3201_channels,
351+ .num_channels = ARRAY_SIZE(mcp3201_channels),
352+ .resolution = 21,
353+ /* 2% max deviation + 144 clock periods to exit shutdown */
354+ .conv_time = 80000 * 1.02 + 144000 / 102.4,
355+ },
356+ [mcp3550_60] = {
357+ .channels = mcp3201_channels,
358+ .num_channels = ARRAY_SIZE(mcp3201_channels),
359+ .resolution = 21,
360+ .conv_time = 66670 * 1.02 + 144000 / 122.88,
361+ },
362+ [mcp3551] = {
363+ .channels = mcp3201_channels,
364+ .num_channels = ARRAY_SIZE(mcp3201_channels),
365+ .resolution = 21,
366+ .conv_time = 73100 * 1.02 + 144000 / 112.64,
367+ },
368+ [mcp3553] = {
369+ .channels = mcp3201_channels,
370+ .num_channels = ARRAY_SIZE(mcp3201_channels),
371+ .resolution = 21,
372+ .conv_time = 16670 * 1.02 + 144000 / 122.88,
373+ },
300374 };
301375
302376 static int mcp320x_probe(struct spi_device *spi)
@@ -304,7 +378,7 @@ static int mcp320x_probe(struct spi_device *spi) · 1 unmodified line
304378 struct iio_dev *indio_dev;
305379 struct mcp320x *adc;
306380 const struct mcp320x_chip_info *chip_info;
307− int ret;
381+ int ret, device_index;
308382
309383 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc));
310384 if (!indio_dev)
@@ -320,7 +394,8 @@ static int mcp320x_probe(struct spi_device *spi) · 9 unmodified lines
320394 indio_dev->info = &mcp320x_info;
321395 spi_set_drvdata(spi, indio_dev);
322396
323− chip_info = &mcp320x_chip_infos[spi_get_device_id(spi)->driver_data];
397+ device_index = spi_get_device_id(spi)->driver_data;
398+ chip_info = &mcp320x_chip_infos[device_index];
324399 indio_dev->channels = chip_info->channels;
325400 indio_dev->num_channels = chip_info->num_channels;
326401
@@ -329,10 +404,41 @@ static int mcp320x_probe(struct spi_device *spi) · 2 unmodified lines
329404 adc->transfer[0].tx_buf = &adc->tx_buf;
330405 adc->transfer[0].len = sizeof(adc->tx_buf);
331406 adc->transfer[1].rx_buf = adc->rx_buf;
332− adc->transfer[1].len = sizeof(adc->rx_buf);
407+ adc->transfer[1].len = DIV_ROUND_UP(chip_info->resolution, 8);
408+
409+ if (chip_info->num_channels == 1)
410+ /* single-channel converters are rx only (no MOSI pin) */
411+ spi_message_init_with_transfers(&adc->msg,
412+ &adc->transfer[1], 1);
413+ else
414+ spi_message_init_with_transfers(&adc->msg, adc->transfer,
415+ ARRAY_SIZE(adc->transfer));
333416
334− spi_message_init_with_transfers(&adc->msg, adc->transfer,
335− ARRAY_SIZE(adc->transfer));
417+ switch (device_index) {
418+ case mcp3550_50:
419+ case mcp3550_60:
420+ case mcp3551:
421+ case mcp3553:
422+ /* rx len increases from 24 to 25 bit in SPI mode 0,0 */
423+ if (!(spi->mode & SPI_CPOL))
424+ adc->transfer[1].len++;
425+
426+ /* conversions are started by asserting CS pin for 8 usec */
427+ adc->start_conv_transfer.delay_usecs = 8;
428+ spi_message_init_with_transfers(&adc->start_conv_msg,
429+ &adc->start_conv_transfer, 1);
430+
431+ /*
432+ * If CS was previously kept low (continuous conversion mode)
433+ * and then changed to high, the chip is in shutdown.
434+ * Sometimes it fails to wake from shutdown and clocks out
435+ * only 0xffffff. The magic sequence of performing two
436+ * conversions without delay between them resets the chip
437+ * and ensures all subsequent conversions succeed.
438+ */
439+ mcp320x_adc_conversion(adc, 0, 1, device_index, &ret);
440+ mcp320x_adc_conversion(adc, 0, 1, device_index, &ret);
441+ }
336442
337443 adc->reg = devm_regulator_get(&spi->dev, "vref");
338444 if (IS_ERR(adc->reg))
@@ -370,62 +476,29 @@ static int mcp320x_remove(struct spi_device *spi) · 31 unmodified lines
370476 #if defined(CONFIG_OF)
371477 static const struct of_device_id mcp320x_dt_ids[] = {
372478 /* NOTE: The use of compatibles with no vendor prefix is deprecated. */
373− {
374− .compatible = "mcp3001",
375− .data = &mcp320x_chip_infos[mcp3001],
376− }, {
377− .compatible = "mcp3002",
378− .data = &mcp320x_chip_infos[mcp3002],
379− }, {
380− .compatible = "mcp3004",
381− .data = &mcp320x_chip_infos[mcp3004],
382− }, {
383− .compatible = "mcp3008",
384− .data = &mcp320x_chip_infos[mcp3008],
385− }, {
386− .compatible = "mcp3201",
387− .data = &mcp320x_chip_infos[mcp3201],
388− }, {
389− .compatible = "mcp3202",
390− .data = &mcp320x_chip_infos[mcp3202],
391− }, {
392− .compatible = "mcp3204",
393− .data = &mcp320x_chip_infos[mcp3204],
394− }, {
395− .compatible = "mcp3208",
396− .data = &mcp320x_chip_infos[mcp3208],
397− }, {
398− .compatible = "mcp3301",
399− .data = &mcp320x_chip_infos[mcp3301],
400− }, {
401− .compatible = "microchip,mcp3001",
402− .data = &mcp320x_chip_infos[mcp3001],
403− }, {
404− .compatible = "microchip,mcp3002",
405− .data = &mcp320x_chip_infos[mcp3002],
406− }, {
407− .compatible = "microchip,mcp3004",
408− .data = &mcp320x_chip_infos[mcp3004],
409− }, {
410− .compatible = "microchip,mcp3008",
411− .data = &mcp320x_chip_infos[mcp3008],
412− }, {
413− .compatible = "microchip,mcp3201",
414− .data = &mcp320x_chip_infos[mcp3201],
415− }, {
416− .compatible = "microchip,mcp3202",
417− .data = &mcp320x_chip_infos[mcp3202],
418− }, {
419− .compatible = "microchip,mcp3204",
420− .data = &mcp320x_chip_infos[mcp3204],
421− }, {
422− .compatible = "microchip,mcp3208",
423− .data = &mcp320x_chip_infos[mcp3208],
424− }, {
425− .compatible = "microchip,mcp3301",
426− .data = &mcp320x_chip_infos[mcp3301],
427− }, {
428− }
479+ { .compatible = "mcp3001" },
480+ { .compatible = "mcp3002" },
481+ { .compatible = "mcp3004" },
482+ { .compatible = "mcp3008" },
483+ { .compatible = "mcp3201" },
484+ { .compatible = "mcp3202" },
485+ { .compatible = "mcp3204" },
486+ { .compatible = "mcp3208" },
487+ { .compatible = "mcp3301" },
488+ { .compatible = "microchip,mcp3001" },
489+ { .compatible = "microchip,mcp3002" },
490+ { .compatible = "microchip,mcp3004" },
491+ { .compatible = "microchip,mcp3008" },
492+ { .compatible = "microchip,mcp3201" },
493+ { .compatible = "microchip,mcp3202" },
494+ { .compatible = "microchip,mcp3204" },
495+ { .compatible = "microchip,mcp3208" },
496+ { .compatible = "microchip,mcp3301" },
497+ { .compatible = "microchip,mcp3550-50" },
498+ { .compatible = "microchip,mcp3550-60" },
499+ { .compatible = "microchip,mcp3551" },
500+ { .compatible = "microchip,mcp3553" },
501+ { }
429502 };
430503 MODULE_DEVICE_TABLE(of, mcp320x_dt_ids);
431504 #endif
@@ -440,6 +513,10 @@ static const struct spi_device_id mcp320x_id[] = { · 8 unmodified lines
440513 { "mcp3204", mcp3204 },
441514 { "mcp3208", mcp3208 },
442515 { "mcp3301", mcp3301 },
516+ { "mcp3550-50", mcp3550_50 },
517+ { "mcp3550-60", mcp3550_60 },
518+ { "mcp3551", mcp3551 },
519+ { "mcp3553", mcp3553 },
443520 { }
444521 };
445522 MODULE_DEVICE_TABLE(spi, mcp320x_id);
@@ -456,5 +533,5 @@ static struct spi_driver mcp320x_driver = { · 10 unmodified lines
456533 module_spi_driver(mcp320x_driver);
457534
458535 MODULE_AUTHOR("Oskar Andero <oskar.andero@gmail.com>");
459−MODULE_DESCRIPTION("Microchip Technology MCP3x01/02/04/08");
536+MODULE_DESCRIPTION("Microchip Technology MCP3x01/02/04/08 and MCP3550/1/3");
460537 MODULE_LICENSE("GPL v2");
drivers/iio/adc/mcp3422.c+0−1
@@ -327,7 +327,6 @@ static const struct iio_info mcp3422_info = { · 326 unmodified lines
327327 .write_raw = mcp3422_write_raw,
328328 .write_raw_get_fmt = mcp3422_write_raw_get_fmt,
329329 .attrs = &mcp3422_attribute_group,
330− .driver_module = THIS_MODULE,
331330 };
332331
333332 static int mcp3422_probe(struct i2c_client *client,
drivers/iio/adc/men_z188_adc.c+0−1
@@ -80,7 +80,6 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, · 79 unmodified lines
8080
8181 static const struct iio_info z188_adc_info = {
8282 .read_raw = &z188_iio_read_raw,
83− .driver_module = THIS_MODULE,
8483 };
8584
8685 static void men_z188_config_channels(void __iomem *addr)
drivers/iio/adc/meson_saradc.c+0−1
@@ -840,7 +840,6 @@ out: · 839 unmodified lines
840840
841841 static const struct iio_info meson_sar_adc_iio_info = {
842842 .read_raw = meson_sar_adc_iio_info_read_raw,
843− .driver_module = THIS_MODULE,
844843 };
845844
846845 static const struct meson_sar_adc_data meson_sar_adc_meson8_data = {
drivers/iio/adc/mt6577_auxadc.c+1−1
@@ -180,7 +180,6 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, · 179 unmodified lines
180180 }
181181
182182 static const struct iio_info mt6577_auxadc_info = {
183− .driver_module = THIS_MODULE,
184183 .read_raw = &mt6577_auxadc_read_raw,
185184 };
186185
@@ -306,6 +305,7 @@ static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops, · 119 unmodified lines
306305
307306 static const struct of_device_id mt6577_auxadc_of_match[] = {
308307 { .compatible = "mediatek,mt2701-auxadc", },
308+ { .compatible = "mediatek,mt2712-auxadc", },
309309 { .compatible = "mediatek,mt7622-auxadc", },
310310 { .compatible = "mediatek,mt8173-auxadc", },
311311 { }
drivers/iio/adc/mxs-lradc-adc.c+0−2
@@ -382,7 +382,6 @@ static const struct attribute_group mxs_lradc_adc_attribute_group = { · 381 unmodified lines
382382 };
383383
384384 static const struct iio_info mxs_lradc_adc_iio_info = {
385− .driver_module = THIS_MODULE,
386385 .read_raw = mxs_lradc_adc_read_raw,
387386 .write_raw = mxs_lradc_adc_write_raw,
388387 .write_raw_get_fmt = mxs_lradc_adc_write_raw_get_fmt,
@@ -455,7 +454,6 @@ static int mxs_lradc_adc_configure_trigger(struct iio_trigger *trig, bool state) · 66 unmodified lines
455454 }
456455
457456 static const struct iio_trigger_ops mxs_lradc_adc_trigger_ops = {
458− .owner = THIS_MODULE,
459457 .set_trigger_state = &mxs_lradc_adc_configure_trigger,
460458 };
461459
drivers/iio/adc/nau7802.c+0−1
@@ -402,7 +402,6 @@ static int nau7802_write_raw_get_fmt(struct iio_dev *indio_dev, · 401 unmodified lines
402402 }
403403
404404 static const struct iio_info nau7802_info = {
405− .driver_module = THIS_MODULE,
406405 .read_raw = &nau7802_read_raw,
407406 .write_raw = &nau7802_write_raw,
408407 .write_raw_get_fmt = nau7802_write_raw_get_fmt,
drivers/iio/adc/palmas_gpadc.c+0−1
@@ -430,7 +430,6 @@ out: · 429 unmodified lines
430430
431431 static const struct iio_info palmas_gpadc_iio_info = {
432432 .read_raw = palmas_gpadc_read_raw,
433− .driver_module = THIS_MODULE,
434433 };
435434
436435 #define PALMAS_ADC_CHAN_IIO(chan, _type, chan_info) \
drivers/iio/adc/qcom-pm8xxx-xoadc.c+0−1
@@ -728,7 +728,6 @@ static int pm8xxx_of_xlate(struct iio_dev *indio_dev, · 727 unmodified lines
728728 }
729729
730730 static const struct iio_info pm8xxx_xoadc_info = {
731− .driver_module = THIS_MODULE,
732731 .of_xlate = pm8xxx_of_xlate,
733732 .read_raw = pm8xxx_read_raw,
734733 };
drivers/iio/adc/qcom-spmi-iadc.c+0−1
@@ -356,7 +356,6 @@ static int iadc_read_raw(struct iio_dev *indio_dev, · 355 unmodified lines
356356
357357 static const struct iio_info iadc_info = {
358358 .read_raw = iadc_read_raw,
359− .driver_module = THIS_MODULE,
360359 };
361360
362361 static irqreturn_t iadc_isr(int irq, void *dev_id)
drivers/iio/adc/qcom-spmi-vadc.c+0−1
@@ -506,7 +506,6 @@ static int vadc_of_xlate(struct iio_dev *indio_dev, · 505 unmodified lines
506506 static const struct iio_info vadc_info = {
507507 .read_raw = vadc_read_raw,
508508 .of_xlate = vadc_of_xlate,
509− .driver_module = THIS_MODULE,
510509 };
511510
512511 struct vadc_channels {
drivers/iio/adc/rcar-gyroadc.c+3−5
@@ -277,7 +277,6 @@ static int rcar_gyroadc_reg_access(struct iio_dev *indio_dev, · 276 unmodified lines
277277 }
278278
279279 static const struct iio_info rcar_gyroadc_iio_info = {
280− .driver_module = THIS_MODULE,
281280 .read_raw = rcar_gyroadc_read_raw,
282281 .debugfs_reg_access = rcar_gyroadc_reg_access,
283282 };
@@ -349,7 +348,7 @@ static int rcar_gyroadc_parse_subdevs(struct iio_dev *indio_dev) · 65 unmodified lines
349348 continue;
350349 }
351350
352− childmode = (unsigned int)of_id->data;
351+ childmode = (uintptr_t)of_id->data;
353352 switch (childmode) {
354353 case RCAR_GYROADC_MODE_SELECT_1_MB88101A:
355354 sample_width = 12;
@@ -488,8 +487,6 @@ err: · 132 unmodified lines
488487
489488 static int rcar_gyroadc_probe(struct platform_device *pdev)
490489 {
491− const struct of_device_id *of_id =
492− of_match_device(rcar_gyroadc_match, &pdev->dev);
493490 struct device *dev = &pdev->dev;
494491 struct rcar_gyroadc *priv;
495492 struct iio_dev *indio_dev;
@@ -526,7 +523,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) · 30 unmodified lines
526523 if (ret)
527524 return ret;
528525
529− priv->model = (enum rcar_gyroadc_model)of_id->data;
526+ priv->model = (enum rcar_gyroadc_model)
527+ of_device_get_match_data(&pdev->dev);
530528
531529 platform_set_drvdata(pdev, indio_dev);
532530
drivers/iio/adc/rockchip_saradc.c+0−1
@@ -125,7 +125,6 @@ static irqreturn_t rockchip_saradc_isr(int irq, void *dev_id) · 124 unmodified lines
125125
126126 static const struct iio_info rockchip_saradc_iio_info = {
127127 .read_raw = rockchip_saradc_read_raw,
128− .driver_module = THIS_MODULE,
129128 };
130129
131130 #define ADC_CHANNEL(_index, _id) { \
drivers/iio/adc/spear_adc.c+0−1
@@ -254,7 +254,6 @@ static int spear_adc_configure(struct spear_adc_state *st) · 253 unmodified lines
254254 static const struct iio_info spear_adc_info = {
255255 .read_raw = &spear_adc_read_raw,
256256 .write_raw = &spear_adc_write_raw,
257− .driver_module = THIS_MODULE,
258257 };
259258
260259 static int spear_adc_probe(struct platform_device *pdev)
drivers/iio/adc/stm32-adc-core.c+13−0
@@ -139,6 +139,11 @@ static int stm32f4_adc_clk_sel(struct platform_device *pdev, · 138 unmodified lines
139139 }
140140
141141 rate = clk_get_rate(priv->aclk);
142+ if (!rate) {
143+ dev_err(&pdev->dev, "Invalid clock rate: 0\n");
144+ return -EINVAL;
145+ }
146+
142147 for (i = 0; i < ARRAY_SIZE(stm32f4_pclk_div); i++) {
143148 if ((rate / stm32f4_pclk_div[i]) <= STM32F4_ADC_MAX_CLK_RATE)
144149 break;
@@ -216,6 +221,10 @@ static int stm32h7_adc_clk_sel(struct platform_device *pdev, · 71 unmodified lines
216221 * From spec: PLL output musn't exceed max rate
217222 */
218223 rate = clk_get_rate(priv->aclk);
224+ if (!rate) {
225+ dev_err(&pdev->dev, "Invalid adc clock rate: 0\n");
226+ return -EINVAL;
227+ }
219228
220229 for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) {
221230 ckmode = stm32h7_adc_ckmodes_spec[i].ckmode;
@@ -232,6 +241,10 @@ static int stm32h7_adc_clk_sel(struct platform_device *pdev, · 10 unmodified lines
232241
233242 /* Synchronous clock modes (e.g. ckmode is 1, 2 or 3) */
234243 rate = clk_get_rate(priv->bclk);
244+ if (!rate) {
245+ dev_err(&pdev->dev, "Invalid bus clock rate: 0\n");
246+ return -EINVAL;
247+ }
235248
236249 for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) {
237250 ckmode = stm32h7_adc_ckmodes_spec[i].ckmode;
drivers/iio/adc/stm32-adc.c+1−1
@@ -531,6 +531,7 @@ static struct stm32_adc_trig_info stm32h7_adc_trigs[] = { · 530 unmodified lines
531531 { TIM2_TRGO, STM32_EXT11 },
532532 { TIM4_TRGO, STM32_EXT12 },
533533 { TIM6_TRGO, STM32_EXT13 },
534+ { TIM15_TRGO, STM32_EXT14 },
534535 { TIM3_CH4, STM32_EXT15 },
535536 { LPTIM1_OUT, STM32_EXT18 },
536537 { LPTIM2_OUT, STM32_EXT19 },
@@ -1385,7 +1386,6 @@ static const struct iio_info stm32_adc_iio_info = { · 848 unmodified lines
13851386 .update_scan_mode = stm32_adc_update_scan_mode,
13861387 .debugfs_reg_access = stm32_adc_debugfs_reg_access,
13871388 .of_xlate = stm32_adc_of_xlate,
1388− .driver_module = THIS_MODULE,
13891389 };
13901390
13911391 static unsigned int stm32_adc_dma_residue(struct stm32_adc *adc)
drivers/iio/adc/stx104.c+0−1
@@ -172,7 +172,6 @@ static int stx104_write_raw(struct iio_dev *indio_dev, · 171 unmodified lines
172172 }
173173
174174 static const struct iio_info stx104_info = {
175− .driver_module = THIS_MODULE,
176175 .read_raw = stx104_read_raw,
177176 .write_raw = stx104_write_raw
178177 };
drivers/iio/adc/sun4i-gpadc-iio.c+21−24
@@ -352,7 +352,6 @@ static int sun4i_gpadc_read_raw(struct iio_dev *indio_dev, · 351 unmodified lines
352352
353353 static const struct iio_info sun4i_gpadc_iio_info = {
354354 .read_raw = sun4i_gpadc_read_raw,
355− .driver_module = THIS_MODULE,
356355 };
357356
358357 static irqreturn_t sun4i_gpadc_temp_data_irq_handler(int irq, void *dev_id)
@@ -502,17 +501,15 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 143 unmodified lines
502501 struct iio_dev *indio_dev)
503502 {
504503 struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
505− const struct of_device_id *of_dev;
506504 struct resource *mem;
507505 void __iomem *base;
508506 int ret;
509507
510− of_dev = of_match_device(sun4i_gpadc_of_id, &pdev->dev);
511− if (!of_dev)
508+ info->data = of_device_get_match_data(&pdev->dev);
509+ if (!info->data)
512510 return -ENODEV;
513511
514512 info->no_irq = true;
515− info->data = (struct gpadc_data *)of_dev->data;
516513 indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels);
517514 indio_dev->channels = sun8i_a33_gpadc_channels;
518515
@@ -529,17 +526,10 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 10 unmodified lines
529526 return ret;
530527 }
531528
532− if (!IS_ENABLED(CONFIG_THERMAL_OF))
533− return 0;
529+ if (IS_ENABLED(CONFIG_THERMAL_OF))
530+ info->sensor_device = &pdev->dev;
534531
535− info->sensor_device = &pdev->dev;
536− info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0,
537− info, &sun4i_ts_tz_ops);
538− if (IS_ERR(info->tzd))
539− dev_err(&pdev->dev, "could not register thermal sensor: %ld\n",
540− PTR_ERR(info->tzd));
541−
542− return PTR_ERR_OR_ZERO(info->tzd);
532+ return 0;
543533 }
544534
545535 static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
@@ -586,15 +576,6 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, · 40 unmodified lines
586576 * return the temperature.
587577 */
588578 info->sensor_device = pdev->dev.parent;
589− info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
590− 0, info,
591− &sun4i_ts_tz_ops);
592− if (IS_ERR(info->tzd)) {
593− dev_err(&pdev->dev,
594− "could not register thermal sensor: %ld\n",
595− PTR_ERR(info->tzd));
596− return PTR_ERR(info->tzd);
597− }
598579 } else {
599580 indio_dev->num_channels =
600581 ARRAY_SIZE(sun4i_gpadc_channels_no_temp);
@@ -664,6 +645,22 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) · 63 unmodified lines
664645 pm_runtime_set_suspended(&pdev->dev);
665646 pm_runtime_enable(&pdev->dev);
666647
648+ if (IS_ENABLED(CONFIG_THERMAL_OF)) {
649+ info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
650+ 0, info,
651+ &sun4i_ts_tz_ops);
652+ /*
653+ * Do not fail driver probing when failing to register in
654+ * thermal because no thermal DT node is found.
655+ */
656+ if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) {
657+ dev_err(&pdev->dev,
658+ "could not register thermal sensor: %ld\n",
659+ PTR_ERR(info->tzd));
660+ return PTR_ERR(info->tzd);
661+ }
662+ }
663+
667664 ret = devm_iio_device_register(&pdev->dev, indio_dev);
668665 if (ret < 0) {
669666 dev_err(&pdev->dev, "could not register the device\n");
drivers/iio/adc/ti-adc081c.c+0−1
@@ -124,7 +124,6 @@ static struct adcxx1c_model adcxx1c_models[] = { · 123 unmodified lines
124124
125125 static const struct iio_info adc081c_info = {
126126 .read_raw = adc081c_read_raw,
127− .driver_module = THIS_MODULE,
128127 };
129128
130129 static irqreturn_t adc081c_trigger_handler(int irq, void *p)
drivers/iio/adc/ti-adc0832.c+0−1
@@ -195,7 +195,6 @@ static int adc0832_read_raw(struct iio_dev *iio, · 194 unmodified lines
195195
196196 static const struct iio_info adc0832_info = {
197197 .read_raw = adc0832_read_raw,
198− .driver_module = THIS_MODULE,
199198 };
200199
201200 static irqreturn_t adc0832_trigger_handler(int irq, void *p)
drivers/iio/adc/ti-adc084s021.c+0−1
@@ -186,7 +186,6 @@ static int adc084s021_buffer_postdisable(struct iio_dev *indio_dev) · 185 unmodified lines
186186
187187 static const struct iio_info adc084s021_info = {
188188 .read_raw = adc084s021_read_raw,
189− .driver_module = THIS_MODULE,
190189 };
191190
192191 static const struct iio_buffer_setup_ops adc084s021_buffer_setup_ops = {
drivers/iio/adc/ti-adc108s102.c+0−1
@@ -220,7 +220,6 @@ static int adc108s102_read_raw(struct iio_dev *indio_dev, · 219 unmodified lines
220220 static const struct iio_info adc108s102_info = {
221221 .read_raw = &adc108s102_read_raw,
222222 .update_scan_mode = &adc108s102_update_scan_mode,
223− .driver_module = THIS_MODULE,
224223 };
225224
226225 static int adc108s102_probe(struct spi_device *spi)
drivers/iio/adc/ti-adc12138.c+1−2
@@ -164,7 +164,7 @@ static int __adc12138_start_conv(struct adc12138 *adc, · 163 unmodified lines
164164 void *data, int len)
165165
166166 {
167− const u8 ch_to_mux[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
167+ static const u8 ch_to_mux[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
168168 u8 mode = (ch_to_mux[channel->channel] << 4) |
169169 (channel->differential ? 0 : 0x80);
170170
@@ -277,7 +277,6 @@ static int adc12138_read_raw(struct iio_dev *iio, · 106 unmodified lines
277277
278278 static const struct iio_info adc12138_info = {
279279 .read_raw = adc12138_read_raw,
280− .driver_module = THIS_MODULE,
281280 };
282281
283282 static int adc12138_init(struct adc12138 *adc)
drivers/iio/adc/ti-adc128s052.c+0−1
@@ -130,7 +130,6 @@ static const struct adc128_configuration adc128_config[] = { · 129 unmodified lines
130130
131131 static const struct iio_info adc128_info = {
132132 .read_raw = adc128_read_raw,
133− .driver_module = THIS_MODULE,
134133 };
135134
136135 static int adc128_probe(struct spi_device *spi)
drivers/iio/adc/ti-adc161s626.c+0−1
@@ -173,7 +173,6 @@ static int ti_adc_read_raw(struct iio_dev *indio_dev, · 172 unmodified lines
173173 }
174174
175175 static const struct iio_info ti_adc_info = {
176− .driver_module = THIS_MODULE,
177176 .read_raw = ti_adc_read_raw,
178177 };
179178
drivers/iio/adc/ti-ads1015.c+10−12
@@ -332,7 +332,7 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on) · 331 unmodified lines
332332 static
333333 int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
334334 {
335− int ret, pga, dr, conv_time;
335+ int ret, pga, dr, dr_old, conv_time;
336336 unsigned int old, mask, cfg;
337337
338338 if (chan < 0 || chan >= ADS1015_CHANNELS)
@@ -358,17 +358,17 @@ int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val) · 19 unmodified lines
358358 }
359359
360360 cfg = (old & ~mask) | (cfg & mask);
361−
362− ret = regmap_write(data->regmap, ADS1015_CFG_REG, cfg);
363− if (ret)
364− return ret;
365−
366− if (old != cfg || data->conv_invalid) {
367− int dr_old = (old & ADS1015_CFG_DR_MASK) >>
368− ADS1015_CFG_DR_SHIFT;
369−
361+ if (old != cfg) {
362+ ret = regmap_write(data->regmap, ADS1015_CFG_REG, cfg);
363+ if (ret)
364+ return ret;
365+ data->conv_invalid = true;
366+ }
367+ if (data->conv_invalid) {
368+ dr_old = (old & ADS1015_CFG_DR_MASK) >> ADS1015_CFG_DR_SHIFT;
370369 conv_time = DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr_old]);
371370 conv_time += DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr]);
371+ conv_time += conv_time / 10; /* 10% internal clock inaccuracy */
372372 usleep_range(conv_time, conv_time + 1);
373373 data->conv_invalid = false;
374374 }
@@ -821,7 +821,6 @@ static const struct attribute_group ads1115_attribute_group = { · 446 unmodified lines
821821 };
822822
823823 static const struct iio_info ads1015_info = {
824− .driver_module = THIS_MODULE,
825824 .read_raw = ads1015_read_raw,
826825 .write_raw = ads1015_write_raw,
827826 .read_event_value = ads1015_read_event,
@@ -832,7 +831,6 @@ static const struct iio_info ads1015_info = { · 4 unmodified lines
832831 };
833832
834833 static const struct iio_info ads1115_info = {
835− .driver_module = THIS_MODULE,
836834 .read_raw = ads1015_read_raw,
837835 .write_raw = ads1015_write_raw,
838836 .read_event_value = ads1015_read_event,
drivers/iio/adc/ti-ads7950.c+0−1
@@ -372,7 +372,6 @@ static int ti_ads7950_read_raw(struct iio_dev *indio_dev, · 371 unmodified lines
372372 static const struct iio_info ti_ads7950_info = {
373373 .read_raw = &ti_ads7950_read_raw,
374374 .update_scan_mode = ti_ads7950_update_scan_mode,
375− .driver_module = THIS_MODULE,
376375 };
377376
378377 static int ti_ads7950_probe(struct spi_device *spi)
drivers/iio/adc/ti-ads8688.c+0−2
@@ -369,7 +369,6 @@ static const struct iio_info ads8688_info = { · 368 unmodified lines
369369 .write_raw = &ads8688_write_raw,
370370 .write_raw_get_fmt = &ads8688_write_raw_get_fmt,
371371 .attrs = &ads8688_attribute_group,
372− .driver_module = THIS_MODULE,
373372 };
374373
375374 static const struct ads8688_chip_info ads8688_chip_info_tbl[] = {
@@ -474,7 +473,6 @@ MODULE_DEVICE_TABLE(of, ads8688_of_match); · 98 unmodified lines
474473 static struct spi_driver ads8688_driver = {
475474 .driver = {
476475 .name = "ads8688",
477− .owner = THIS_MODULE,
478476 },
479477 .probe = ads8688_probe,
480478 .remove = ads8688_remove,
drivers/iio/adc/ti-tlc4541.c+0−1
@@ -157,7 +157,6 @@ static int tlc4541_read_raw(struct iio_dev *indio_dev, · 156 unmodified lines
157157
158158 static const struct iio_info tlc4541_info = {
159159 .read_raw = &tlc4541_read_raw,
160− .driver_module = THIS_MODULE,
161160 };
162161
163162 static int tlc4541_probe(struct spi_device *spi)
drivers/iio/adc/ti_am335x_adc.c+0−1
@@ -533,7 +533,6 @@ err_unlock: · 532 unmodified lines
533533
534534 static const struct iio_info tiadc_info = {
535535 .read_raw = &tiadc_read_raw,
536− .driver_module = THIS_MODULE,
537536 };
538537
539538 static int tiadc_request_dma(struct platform_device *pdev,
drivers/iio/adc/twl4030-madc.c+0−1
@@ -212,7 +212,6 @@ static int twl4030_madc_read(struct iio_dev *iio_dev, · 211 unmodified lines
212212
213213 static const struct iio_info twl4030_madc_iio_info = {
214214 .read_raw = &twl4030_madc_read,
215− .driver_module = THIS_MODULE,
216215 };
217216
218217 #define TWL4030_ADC_CHANNEL(_channel, _type, _name) { \
drivers/iio/adc/twl6030-gpadc.c+0−1
@@ -843,7 +843,6 @@ static const struct iio_chan_spec twl6032_gpadc_iio_channels[] = { · 842 unmodified lines
843843
844844 static const struct iio_info twl6030_gpadc_iio_info = {
845845 .read_raw = &twl6030_gpadc_read_raw,
846− .driver_module = THIS_MODULE,
847846 };
848847
849848 static const struct twl6030_gpadc_platform_data twl6030_pdata = {
drivers/iio/adc/vf610_adc.c+0−1
@@ -799,7 +799,6 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev, · 798 unmodified lines
799799 }
800800
801801 static const struct iio_info vf610_adc_iio_info = {
802− .driver_module = THIS_MODULE,
803802 .read_raw = &vf610_read_raw,
804803 .write_raw = &vf610_write_raw,
805804 .debugfs_reg_access = &vf610_adc_reg_access,
drivers/iio/adc/viperboard_adc.c+0−1
@@ -107,7 +107,6 @@ error: · 106 unmodified lines
107107
108108 static const struct iio_info vprbrd_adc_iio_info = {
109109 .read_raw = &vprbrd_iio_read_raw,
110− .driver_module = THIS_MODULE,
111110 };
112111
113112 static int vprbrd_adc_probe(struct platform_device *pdev)
drivers/iio/adc/xilinx-xadc-core.c+0−2
@@ -675,7 +675,6 @@ err_out: · 674 unmodified lines
675675 }
676676
677677 static const struct iio_trigger_ops xadc_trigger_ops = {
678− .owner = THIS_MODULE,
679678 .set_trigger_state = &xadc_trigger_set_state,
680679 };
681680
@@ -1028,7 +1027,6 @@ static const struct iio_info xadc_info = { · 346 unmodified lines
10281027 .read_event_value = &xadc_read_event_value,
10291028 .write_event_value = &xadc_write_event_value,
10301029 .update_scan_mode = &xadc_update_scan_mode,
1031− .driver_module = THIS_MODULE,
10321030 };
10331031
10341032 static const struct of_device_id xadc_of_match_table[] = {
drivers/iio/amplifiers/ad8366.c+0−1
@@ -117,7 +117,6 @@ static int ad8366_write_raw(struct iio_dev *indio_dev, · 116 unmodified lines
117117 static const struct iio_info ad8366_info = {
118118 .read_raw = &ad8366_read_raw,
119119 .write_raw = &ad8366_write_raw,
120− .driver_module = THIS_MODULE,
121120 };
122121
123122 #define AD8366_CHAN(_channel) { \
drivers/iio/chemical/ams-iaq-core.c+0−1
@@ -141,7 +141,6 @@ err_out: · 140 unmodified lines
141141
142142 static const struct iio_info ams_iaqcore_info = {
143143 .read_raw = ams_iaqcore_read_raw,
144− .driver_module = THIS_MODULE,
145144 };
146145
147146 static int ams_iaqcore_probe(struct i2c_client *client,
drivers/iio/chemical/atlas-ph-sensor.c+0−2
@@ -344,7 +344,6 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev) · 343 unmodified lines
344344 }
345345
346346 static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
347− .owner = THIS_MODULE,
348347 };
349348
350349 static const struct iio_buffer_setup_ops atlas_buffer_setup_ops = {
@@ -499,7 +498,6 @@ static int atlas_write_raw(struct iio_dev *indio_dev, · 148 unmodified lines
499498 }
500499
501500 static const struct iio_info atlas_info = {
502− .driver_module = THIS_MODULE,
503501 .read_raw = atlas_read_raw,
504502 .write_raw = atlas_write_raw,
505503 };
drivers/iio/chemical/ccs811.c+85−2
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/i2c.h>
2323 #include <linux/iio/iio.h>
2424 #include <linux/iio/buffer.h>
25+#include <linux/iio/trigger.h>
2526 #include <linux/iio/triggered_buffer.h>
2627 #include <linux/iio/trigger_consumer.h>
2728 #include <linux/module.h>
@@ -59,6 +60,8 @@ · 31 unmodified lines
5960 #define CCS811_MODE_IAQ_60SEC 0x30
6061 #define CCS811_MODE_RAW_DATA 0x40
6162
63+#define CCS811_MEAS_MODE_INTERRUPT BIT(3)
64+
6265 #define CCS811_VOLTAGE_MASK 0x3FF
6366
6467 struct ccs811_reading {
@@ -73,6 +76,8 @@ struct ccs811_data { · 8 unmodified lines
7376 struct i2c_client *client;
7477 struct mutex lock; /* Protect readings */
7578 struct ccs811_reading buffer;
79+ struct iio_trigger *drdy_trig;
80+ bool drdy_trig_on;
7681 };
7782
7883 static const struct iio_chan_spec ccs811_channels[] = {
@@ -193,10 +198,14 @@ static int ccs811_read_raw(struct iio_dev *indio_dev, · 114 unmodified lines
193198
194199 switch (mask) {
195200 case IIO_CHAN_INFO_RAW:
201+ ret = iio_device_claim_direct_mode(indio_dev);
202+ if (ret)
203+ return ret;
196204 mutex_lock(&data->lock);
197205 ret = ccs811_get_measurement(data);
198206 if (ret < 0) {
199207 mutex_unlock(&data->lock);
208+ iio_device_release_direct_mode(indio_dev);
200209 return ret;
201210 }
202211
@@ -228,6 +237,7 @@ static int ccs811_read_raw(struct iio_dev *indio_dev, · 25 unmodified lines
228237 ret = -EINVAL;
229238 }
230239 mutex_unlock(&data->lock);
240+ iio_device_release_direct_mode(indio_dev);
231241
232242 return ret;
233243
@@ -270,7 +280,31 @@ static int ccs811_read_raw(struct iio_dev *indio_dev, · 36 unmodified lines
270280
271281 static const struct iio_info ccs811_info = {
272282 .read_raw = ccs811_read_raw,
273− .driver_module = THIS_MODULE,
283+};
284+
285+static int ccs811_set_trigger_state(struct iio_trigger *trig,
286+ bool state)
287+{
288+ struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
289+ struct ccs811_data *data = iio_priv(indio_dev);
290+ int ret;
291+
292+ ret = i2c_smbus_read_byte_data(data->client, CCS811_MEAS_MODE);
293+ if (ret < 0)
294+ return ret;
295+
296+ if (state)
297+ ret |= CCS811_MEAS_MODE_INTERRUPT;
298+ else
299+ ret &= ~CCS811_MEAS_MODE_INTERRUPT;
300+
301+ data->drdy_trig_on = state;
302+
303+ return i2c_smbus_write_byte_data(data->client, CCS811_MEAS_MODE, ret);
304+}
305+
306+static const struct iio_trigger_ops ccs811_trigger_ops = {
307+ .set_trigger_state = ccs811_set_trigger_state,
274308 };
275309
276310 static irqreturn_t ccs811_trigger_handler(int irq, void *p)
@@ -298,6 +332,17 @@ err: · 21 unmodified lines
298332 return IRQ_HANDLED;
299333 }
300334
335+static irqreturn_t ccs811_data_rdy_trigger_poll(int irq, void *private)
336+{
337+ struct iio_dev *indio_dev = private;
338+ struct ccs811_data *data = iio_priv(indio_dev);
339+
340+ if (data->drdy_trig_on)
341+ iio_trigger_poll(data->drdy_trig);
342+
343+ return IRQ_HANDLED;
344+}
345+
301346 static int ccs811_probe(struct i2c_client *client,
302347 const struct i2c_device_id *id)
303348 {
@@ -346,16 +391,48 @@ static int ccs811_probe(struct i2c_client *client, · 42 unmodified lines
346391 indio_dev->dev.parent = &client->dev;
347392 indio_dev->name = id->name;
348393 indio_dev->info = &ccs811_info;
394+ indio_dev->modes = INDIO_DIRECT_MODE;
349395
350396 indio_dev->channels = ccs811_channels;
351397 indio_dev->num_channels = ARRAY_SIZE(ccs811_channels);
352398
399+ if (client->irq > 0) {
400+ ret = devm_request_threaded_irq(&client->dev, client->irq,
401+ ccs811_data_rdy_trigger_poll,
402+ NULL,
403+ IRQF_TRIGGER_FALLING |
404+ IRQF_ONESHOT,
405+ "ccs811_irq", indio_dev);
406+ if (ret) {
407+ dev_err(&client->dev, "irq request error %d\n", -ret);
408+ goto err_poweroff;
409+ }
410+
411+ data->drdy_trig = devm_iio_trigger_alloc(&client->dev,
412+ "%s-dev%d",
413+ indio_dev->name,
414+ indio_dev->id);
415+ if (!data->drdy_trig) {
416+ ret = -ENOMEM;
417+ goto err_poweroff;
418+ }
419+
420+ data->drdy_trig->dev.parent = &client->dev;
421+ data->drdy_trig->ops = &ccs811_trigger_ops;
422+ iio_trigger_set_drvdata(data->drdy_trig, indio_dev);
423+ indio_dev->trig = data->drdy_trig;
424+ iio_trigger_get(indio_dev->trig);
425+ ret = iio_trigger_register(data->drdy_trig);
426+ if (ret)
427+ goto err_poweroff;
428+ }
429+
353430 ret = iio_triggered_buffer_setup(indio_dev, NULL,
354431 ccs811_trigger_handler, NULL);
355432
356433 if (ret < 0) {
357434 dev_err(&client->dev, "triggered buffer setup failed\n");
358− goto err_poweroff;
435+ goto err_trigger_unregister;
359436 }
360437
361438 ret = iio_device_register(indio_dev);
@@ -367,6 +444,9 @@ static int ccs811_probe(struct i2c_client *client, · 5 unmodified lines
367444
368445 err_buffer_cleanup:
369446 iio_triggered_buffer_cleanup(indio_dev);
447+err_trigger_unregister:
448+ if (data->drdy_trig)
449+ iio_trigger_unregister(data->drdy_trig);
370450 err_poweroff:
371451 i2c_smbus_write_byte_data(client, CCS811_MEAS_MODE, CCS811_MODE_IDLE);
372452
@@ -376,9 +456,12 @@ err_poweroff: · 3 unmodified lines
376456 static int ccs811_remove(struct i2c_client *client)
377457 {
378458 struct iio_dev *indio_dev = i2c_get_clientdata(client);
459+ struct ccs811_data *data = iio_priv(indio_dev);
379460
380461 iio_device_unregister(indio_dev);
381462 iio_triggered_buffer_cleanup(indio_dev);
463+ if (data->drdy_trig)
464+ iio_trigger_unregister(data->drdy_trig);
382465
383466 return i2c_smbus_write_byte_data(client, CCS811_MEAS_MODE,
384467 CCS811_MODE_IDLE);
drivers/iio/chemical/vz89x.c+0−1
@@ -326,7 +326,6 @@ static int vz89x_read_raw(struct iio_dev *indio_dev, · 325 unmodified lines
326326 static const struct iio_info vz89x_info = {
327327 .attrs = &vz89x_attrs_group,
328328 .read_raw = vz89x_read_raw,
329− .driver_module = THIS_MODULE,
330329 };
331330
332331 static const struct vz89x_chip_data vz89x_chips[] = {
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c+0−1
@@ -185,7 +185,6 @@ static int cros_ec_sensors_write(struct iio_dev *indio_dev, · 184 unmodified lines
185185 static const struct iio_info ec_sensors_info = {
186186 .read_raw = &cros_ec_sensors_read,
187187 .write_raw = &cros_ec_sensors_write,
188− .driver_module = THIS_MODULE,
189188 };
190189
191190 static int cros_ec_sensors_probe(struct platform_device *pdev)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c+9−4
@@ -179,6 +179,10 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 178 unmodified lines
179179 int ret;
180180
181181 atomic_set(&st->user_requested_state, state);
182+
183+ if (atomic_add_unless(&st->runtime_pm_enable, 1, 1))
184+ pm_runtime_enable(&st->pdev->dev);
185+
182186 if (state)
183187 ret = pm_runtime_get_sync(&st->pdev->dev);
184188 else {
@@ -221,7 +225,8 @@ static void hid_sensor_set_power_work(struct work_struct *work) · 36 unmodified lines
221225 if (attrb->latency_ms > 0)
222226 hid_sensor_set_report_latency(attrb, attrb->latency_ms);
223227
224− _hid_sensor_power_state(attrb, true);
228+ if (atomic_read(&attrb->user_requested_state))
229+ _hid_sensor_power_state(attrb, true);
225230 }
226231
227232 static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
@@ -232,7 +237,9 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, · 4 unmodified lines
232237
233238 void hid_sensor_remove_trigger(struct hid_sensor_common *attrb)
234239 {
235− pm_runtime_disable(&attrb->pdev->dev);
240+ if (atomic_read(&attrb->runtime_pm_enable))
241+ pm_runtime_disable(&attrb->pdev->dev);
242+
236243 pm_runtime_set_suspended(&attrb->pdev->dev);
237244 pm_runtime_put_noidle(&attrb->pdev->dev);
238245
@@ -243,7 +250,6 @@ void hid_sensor_remove_trigger(struct hid_sensor_common *attrb) · 4 unmodified lines
243250 EXPORT_SYMBOL(hid_sensor_remove_trigger);
244251
245252 static const struct iio_trigger_ops hid_sensor_trigger_ops = {
246− .owner = THIS_MODULE,
247253 .set_trigger_state = &hid_sensor_data_rdy_trigger_set_state,
248254 };
249255
@@ -283,7 +289,6 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, · 33 unmodified lines
283289 INIT_WORK(&attrb->work, hid_sensor_set_power_work);
284290
285291 pm_suspend_ignore_children(&attrb->pdev->dev, true);
286− pm_runtime_enable(&attrb->pdev->dev);
287292 /* Default to 3 seconds, but can be changed from sysfs */
288293 pm_runtime_set_autosuspend_delay(&attrb->pdev->dev,
289294 3000);
drivers/iio/common/st_sensors/st_sensors_core.c+40−19
@@ -93,6 +93,9 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) · 92 unmodified lines
9393 struct st_sensor_odr_avl odr_out = {0, 0};
9494 struct st_sensor_data *sdata = iio_priv(indio_dev);
9595
96+ if (!sdata->sensor_settings->odr.addr)
97+ return 0;
98+
9699 err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
97100 if (err < 0)
98101 goto st_sensors_match_odr_error;
@@ -221,11 +224,14 @@ EXPORT_SYMBOL(st_sensors_set_enable); · 122 unmodified lines
221224 int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
222225 {
223226 struct st_sensor_data *sdata = iio_priv(indio_dev);
227+ int err = 0;
224228
225− return st_sensors_write_data_with_mask(indio_dev,
229+ if (sdata->sensor_settings->enable_axis.addr)
230+ err = st_sensors_write_data_with_mask(indio_dev,
226231 sdata->sensor_settings->enable_axis.addr,
227232 sdata->sensor_settings->enable_axis.mask,
228233 axis_enable);
234+ return err;
229235 }
230236 EXPORT_SYMBOL(st_sensors_set_axis_enable);
231237
@@ -283,7 +289,8 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, · 51 unmodified lines
283289 struct st_sensor_data *sdata = iio_priv(indio_dev);
284290
285291 /* Sensor does not support interrupts */
286− if (sdata->sensor_settings->drdy_irq.addr == 0) {
292+ if (!sdata->sensor_settings->drdy_irq.int1.addr &&
293+ !sdata->sensor_settings->drdy_irq.int2.addr) {
287294 if (pdata->drdy_int_pin)
288295 dev_info(&indio_dev->dev,
289296 "DRDY on pin INT%d specified, but sensor "
@@ -294,7 +301,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, · 4 unmodified lines
294301
295302 switch (pdata->drdy_int_pin) {
296303 case 1:
297− if (sdata->sensor_settings->drdy_irq.mask_int1 == 0) {
304+ if (!sdata->sensor_settings->drdy_irq.int1.mask) {
298305 dev_err(&indio_dev->dev,
299306 "DRDY on INT1 not available.\n");
300307 return -EINVAL;
@@ -302,7 +309,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, · 1 unmodified line
302309 sdata->drdy_int_pin = 1;
303310 break;
304311 case 2:
305− if (sdata->sensor_settings->drdy_irq.mask_int2 == 0) {
312+ if (!sdata->sensor_settings->drdy_irq.int2.mask) {
306313 dev_err(&indio_dev->dev,
307314 "DRDY on INT2 not available.\n");
308315 return -EINVAL;
@@ -315,7 +322,8 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, · 6 unmodified lines
315322 }
316323
317324 if (pdata->open_drain) {
318− if (!sdata->sensor_settings->drdy_irq.addr_od)
325+ if (!sdata->sensor_settings->drdy_irq.int1.addr_od &&
326+ !sdata->sensor_settings->drdy_irq.int2.addr_od)
319327 dev_err(&indio_dev->dev,
320328 "open drain requested but unsupported.\n");
321329 else
@@ -442,11 +450,21 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, · 120 unmodified lines
442450 }
443451
444452 if (sdata->int_pin_open_drain) {
453+ u8 addr, mask;
454+
455+ if (sdata->drdy_int_pin == 1) {
456+ addr = sdata->sensor_settings->drdy_irq.int1.addr_od;
457+ mask = sdata->sensor_settings->drdy_irq.int1.mask_od;
458+ } else {
459+ addr = sdata->sensor_settings->drdy_irq.int2.addr_od;
460+ mask = sdata->sensor_settings->drdy_irq.int2.mask_od;
461+ }
462+
445463 dev_info(&indio_dev->dev,
446− "set interrupt line to open drain mode\n");
447− err = st_sensors_write_data_with_mask(indio_dev,
448− sdata->sensor_settings->drdy_irq.addr_od,
449− sdata->sensor_settings->drdy_irq.mask_od, 1);
464+ "set interrupt line to open drain mode on pin %d\n",
465+ sdata->drdy_int_pin);
466+ err = st_sensors_write_data_with_mask(indio_dev, addr,
467+ mask, 1);
450468 if (err < 0)
451469 return err;
452470 }
@@ -460,17 +478,18 @@ EXPORT_SYMBOL(st_sensors_init_sensor); · 7 unmodified lines
460478 int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
461479 {
462480 int err;
463− u8 drdy_mask;
481+ u8 drdy_addr, drdy_mask;
464482 struct st_sensor_data *sdata = iio_priv(indio_dev);
465483
466− if (!sdata->sensor_settings->drdy_irq.addr) {
484+ if (!sdata->sensor_settings->drdy_irq.int1.addr &&
485+ !sdata->sensor_settings->drdy_irq.int2.addr) {
467486 /*
468487 * there are some devices (e.g. LIS3MDL) where drdy line is
469488 * routed to a given pin and it is not possible to select a
470489 * different one. Take into account irq status register
471490 * to understand if irq trigger can be properly supported
472491 */
473− if (sdata->sensor_settings->drdy_irq.addr_stat_drdy)
492+ if (sdata->sensor_settings->drdy_irq.stat_drdy.addr)
474493 sdata->hw_irq_trigger = enable;
475494 return 0;
476495 }
@@ -485,18 +504,20 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable) · 8 unmodified lines
485504 goto st_accel_set_dataready_irq_error;
486505 }
487506
488− if (sdata->drdy_int_pin == 1)
489− drdy_mask = sdata->sensor_settings->drdy_irq.mask_int1;
490− else
491− drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2;
507+ if (sdata->drdy_int_pin == 1) {
508+ drdy_addr = sdata->sensor_settings->drdy_irq.int1.addr;
509+ drdy_mask = sdata->sensor_settings->drdy_irq.int1.mask;
510+ } else {
511+ drdy_addr = sdata->sensor_settings->drdy_irq.int2.addr;
512+ drdy_mask = sdata->sensor_settings->drdy_irq.int2.mask;
513+ }
492514
493515 /* Flag to the poll function that the hardware trigger is in use */
494516 sdata->hw_irq_trigger = enable;
495517
496518 /* Enable/Disable the interrupt generator for data ready. */
497− err = st_sensors_write_data_with_mask(indio_dev,
498− sdata->sensor_settings->drdy_irq.addr,
499− drdy_mask, (int)enable);
519+ err = st_sensors_write_data_with_mask(indio_dev, drdy_addr,
520+ drdy_mask, (int)enable);
500521
501522 st_accel_set_dataready_irq_error:
502523 return err;
drivers/iio/common/st_sensors/st_sensors_trigger.c+4−12
@@ -31,7 +31,7 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev, · 30 unmodified lines
3131 int ret;
3232
3333 /* How would I know if I can't check it? */
34− if (!sdata->sensor_settings->drdy_irq.addr_stat_drdy)
34+ if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
3535 return -EINVAL;
3636
3737 /* No scan mask, no interrupt */
@@ -39,23 +39,15 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev, · 1 unmodified line
3939 return 0;
4040
4141 ret = sdata->tf->read_byte(&sdata->tb, sdata->dev,
42− sdata->sensor_settings->drdy_irq.addr_stat_drdy,
42+ sdata->sensor_settings->drdy_irq.stat_drdy.addr,
4343 &status);
4444 if (ret < 0) {
4545 dev_err(sdata->dev,
4646 "error checking samples available\n");
4747 return ret;
4848 }
49− /*
50− * the lower bits of .active_scan_mask[0] is directly mapped
51− * to the channels on the sensor: either bit 0 for
52− * one-dimensional sensors, or e.g. x,y,z for accelerometers,
53− * gyroscopes or magnetometers. No sensor use more than 3
54− * channels, so cut the other status bits here.
55− */
56− status &= 0x07;
5749
58− if (status & (u8)indio_dev->active_scan_mask[0])
50+ if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)
5951 return 1;
6052
6153 return 0;
@@ -212,7 +204,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, · 150 unmodified lines
212204 * it was "our" interrupt.
213205 */
214206 if (sdata->int_pin_open_drain &&
215− sdata->sensor_settings->drdy_irq.addr_stat_drdy)
207+ sdata->sensor_settings->drdy_irq.stat_drdy.addr)
216208 irq_trig |= IRQF_SHARED;
217209
218210 err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),
drivers/iio/counter/104-quad-8.c+0−1
@@ -185,7 +185,6 @@ static int quad8_write_raw(struct iio_dev *indio_dev, · 184 unmodified lines
185185 }
186186
187187 static const struct iio_info quad8_info = {
188− .driver_module = THIS_MODULE,
189188 .read_raw = quad8_read_raw,
190189 .write_raw = quad8_write_raw
191190 };
drivers/iio/counter/stm32-lptimer-cnt.c+0−1
@@ -178,7 +178,6 @@ static int stm32_lptim_read_raw(struct iio_dev *indio_dev, · 177 unmodified lines
178178 static const struct iio_info stm32_lptim_cnt_iio_info = {
179179 .read_raw = stm32_lptim_read_raw,
180180 .write_raw = stm32_lptim_write_raw,
181− .driver_module = THIS_MODULE,
182181 };
183182
184183 static const char *const stm32_lptim_quadrature_modes[] = {
drivers/iio/dac/Kconfig+21−1
@@ -60,7 +60,8 @@ config AD5446 · 59 unmodified lines
6060 Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
6161 AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
6262 AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5602, AD5611, AD5612,
63− AD5620, AD5621, AD5622, AD5640, AD5641, AD5660, AD5662 DACs.
63+ AD5620, AD5621, AD5622, AD5640, AD5641, AD5660, AD5662 DACs
64+ as well as Texas Instruments DAC081S101, DAC101S101, DAC121S101.
6465
6566 To compile this driver as a module, choose M here: the
6667 module will be called ad5446.
@@ -221,6 +222,15 @@ config DPOT_DAC · 154 unmodified lines
221222 To compile this driver as a module, choose M here: the module will be
222223 called dpot-dac.
223224
225+config DS4424
226+ tristate "Maxim Integrated DS4422/DS4424 DAC driver"
227+ depends on I2C
228+ help
229+ If you say yes here you get support for Maxim chips DS4422, DS4424.
230+
231+ This driver can also be built as a module. If so, the module
232+ will be called ds4424.
233+
224234 config LPC18XX_DAC
225235 tristate "NXP LPC18xx DAC driver"
226236 depends on ARCH_LPC18XX || COMPILE_TEST
@@ -300,6 +310,16 @@ config STM32_DAC · 73 unmodified lines
300310 config STM32_DAC_CORE
301311 tristate
302312
313+config TI_DAC082S085
314+ tristate "Texas Instruments 8/10/12-bit 2/4-channel DAC driver"
315+ depends on SPI_MASTER
316+ help
317+ Driver for the Texas Instruments (formerly National Semiconductor)
318+ DAC082S085, DAC102S085, DAC122S085, DAC084S085, DAC104S085 and
319+ DAC124S085.
320+
321+ If compiled as a module, it will be called ti-dac082s085.
322+
303323 config VF610_DAC
304324 tristate "Vybrid vf610 DAC driver"
305325 depends on OF
drivers/iio/dac/Makefile+2−0
@@ -24,6 +24,7 @@ obj-$(CONFIG_AD7303) += ad7303.o · 23 unmodified lines
2424 obj-$(CONFIG_AD8801) += ad8801.o
2525 obj-$(CONFIG_CIO_DAC) += cio-dac.o
2626 obj-$(CONFIG_DPOT_DAC) += dpot-dac.o
27+obj-$(CONFIG_DS4424) += ds4424.o
2728 obj-$(CONFIG_LPC18XX_DAC) += lpc18xx_dac.o
2829 obj-$(CONFIG_LTC2632) += ltc2632.o
2930 obj-$(CONFIG_M62332) += m62332.o
@@ -33,4 +34,5 @@ obj-$(CONFIG_MCP4725) += mcp4725.o · 3 unmodified lines
3334 obj-$(CONFIG_MCP4922) += mcp4922.o
3435 obj-$(CONFIG_STM32_DAC_CORE) += stm32-dac-core.o
3536 obj-$(CONFIG_STM32_DAC) += stm32-dac.o
37+obj-$(CONFIG_TI_DAC082S085) += ti-dac082s085.o
3638 obj-$(CONFIG_VF610_DAC) += vf610_dac.o
drivers/iio/dac/ad5064.c+0−1
@@ -366,7 +366,6 @@ static int ad5064_write_raw(struct iio_dev *indio_dev, · 365 unmodified lines
366366 static const struct iio_info ad5064_info = {
367367 .read_raw = ad5064_read_raw,
368368 .write_raw = ad5064_write_raw,
369− .driver_module = THIS_MODULE,
370369 };
371370
372371 static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
drivers/iio/dac/ad5360.c+0−1
@@ -425,7 +425,6 @@ static const struct iio_info ad5360_info = { · 424 unmodified lines
425425 .read_raw = ad5360_read_raw,
426426 .write_raw = ad5360_write_raw,
427427 .attrs = &ad5360_attribute_group,
428− .driver_module = THIS_MODULE,
429428 };
430429
431430 static const char * const ad5360_vref_name[] = {
drivers/iio/dac/ad5380.c+0−1
@@ -237,7 +237,6 @@ static int ad5380_read_raw(struct iio_dev *indio_dev, · 236 unmodified lines
237237 static const struct iio_info ad5380_info = {
238238 .read_raw = ad5380_read_raw,
239239 .write_raw = ad5380_write_raw,
240− .driver_module = THIS_MODULE,
241240 };
242241
243242 static struct iio_chan_spec_ext_info ad5380_ext_info[] = {
drivers/iio/dac/ad5421.c+0−1
@@ -465,7 +465,6 @@ static const struct iio_info ad5421_info = { · 464 unmodified lines
465465 .read_event_config = ad5421_read_event_config,
466466 .write_event_config = ad5421_write_event_config,
467467 .read_event_value = ad5421_read_event_value,
468− .driver_module = THIS_MODULE,
469468 };
470469
471470 static int ad5421_probe(struct spi_device *spi)
drivers/iio/dac/ad5446.c+13−1
@@ -212,7 +212,6 @@ static int ad5446_write_raw(struct iio_dev *indio_dev, · 211 unmodified lines
212212 static const struct iio_info ad5446_info = {
213213 .read_raw = ad5446_read_raw,
214214 .write_raw = ad5446_write_raw,
215− .driver_module = THIS_MODULE,
216215 };
217216
218217 static int ad5446_probe(struct device *dev, const char *name,
@@ -461,10 +460,22 @@ static const struct spi_device_id ad5446_spi_ids[] = { · 242 unmodified lines
461460 {"ad5660-2500", ID_AD5660_2500},
462461 {"ad5660-1250", ID_AD5660_1250},
463462 {"ad5662", ID_AD5662},
463+ {"dac081s101", ID_AD5300}, /* compatible Texas Instruments chips */
464+ {"dac101s101", ID_AD5310},
465+ {"dac121s101", ID_AD5320},
466+ {"dac7512", ID_AD5320},
464467 {}
465468 };
466469 MODULE_DEVICE_TABLE(spi, ad5446_spi_ids);
467470
471+#ifdef CONFIG_OF
472+static const struct of_device_id ad5446_of_ids[] = {
473+ { .compatible = "ti,dac7512" },
474+ { }
475+};
476+MODULE_DEVICE_TABLE(of, ad5446_of_ids);
477+#endif
478+
468479 static int ad5446_spi_probe(struct spi_device *spi)
469480 {
470481 const struct spi_device_id *id = spi_get_device_id(spi);
@@ -481,6 +492,7 @@ static int ad5446_spi_remove(struct spi_device *spi) · 10 unmodified lines
481492 static struct spi_driver ad5446_spi_driver = {
482493 .driver = {
483494 .name = "ad5446",
495+ .of_match_table = of_match_ptr(ad5446_of_ids),
484496 },
485497 .probe = ad5446_spi_probe,
486498 .remove = ad5446_spi_remove,
drivers/iio/dac/ad5449.c+0−1
@@ -193,7 +193,6 @@ static int ad5449_write_raw(struct iio_dev *indio_dev, · 192 unmodified lines
193193 static const struct iio_info ad5449_info = {
194194 .read_raw = ad5449_read_raw,
195195 .write_raw = ad5449_write_raw,
196− .driver_module = THIS_MODULE,
197196 };
198197
199198 #define AD5449_CHANNEL(chan, bits) { \
drivers/iio/dac/ad5504.c+0−1
@@ -232,7 +232,6 @@ static const struct iio_info ad5504_info = { · 231 unmodified lines
232232 .write_raw = ad5504_write_raw,
233233 .read_raw = ad5504_read_raw,
234234 .event_attrs = &ad5504_ev_attribute_group,
235− .driver_module = THIS_MODULE,
236235 };
237236
238237 static const struct iio_chan_spec_ext_info ad5504_ext_info[] = {
drivers/iio/dac/ad5592r-base.c+0−1
@@ -474,7 +474,6 @@ static const struct iio_info ad5592r_info = { · 473 unmodified lines
474474 .read_raw = ad5592r_read_raw,
475475 .write_raw = ad5592r_write_raw,
476476 .write_raw_get_fmt = ad5592r_write_raw_get_fmt,
477− .driver_module = THIS_MODULE,
478477 };
479478
480479 static ssize_t ad5592r_show_scale_available(struct iio_dev *iio_dev,
drivers/iio/dac/ad5624r_spi.c+0−1
@@ -149,7 +149,6 @@ static ssize_t ad5624r_write_dac_powerdown(struct iio_dev *indio_dev, · 148 unmodified lines
149149 static const struct iio_info ad5624r_info = {
150150 .write_raw = ad5624r_write_raw,
151151 .read_raw = ad5624r_read_raw,
152− .driver_module = THIS_MODULE,
153152 };
154153
155154 static const struct iio_chan_spec_ext_info ad5624r_ext_info[] = {
drivers/iio/dac/ad5686.c+0−1
@@ -252,7 +252,6 @@ static int ad5686_write_raw(struct iio_dev *indio_dev, · 251 unmodified lines
252252 static const struct iio_info ad5686_info = {
253253 .read_raw = ad5686_read_raw,
254254 .write_raw = ad5686_write_raw,
255− .driver_module = THIS_MODULE,
256255 };
257256
258257 static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
drivers/iio/dac/ad5755.c+0−1
@@ -417,7 +417,6 @@ static ssize_t ad5755_write_powerdown(struct iio_dev *indio_dev, uintptr_t priv, · 416 unmodified lines
417417 static const struct iio_info ad5755_info = {
418418 .read_raw = ad5755_read_raw,
419419 .write_raw = ad5755_write_raw,
420− .driver_module = THIS_MODULE,
421420 };
422421
423422 static const struct iio_chan_spec_ext_info ad5755_ext_info[] = {
drivers/iio/dac/ad5761.c+0−1
@@ -251,7 +251,6 @@ static int ad5761_write_raw(struct iio_dev *indio_dev, · 250 unmodified lines
251251 static const struct iio_info ad5761_info = {
252252 .read_raw = &ad5761_read_raw,
253253 .write_raw = &ad5761_write_raw,
254− .driver_module = THIS_MODULE,
255254 };
256255
257256 #define AD5761_CHAN(_bits) { \
drivers/iio/dac/ad5764.c+0−1
@@ -268,7 +268,6 @@ static int ad5764_read_raw(struct iio_dev *indio_dev, · 267 unmodified lines
268268 static const struct iio_info ad5764_info = {
269269 .read_raw = ad5764_read_raw,
270270 .write_raw = ad5764_write_raw,
271− .driver_module = THIS_MODULE,
272271 };
273272
274273 static int ad5764_probe(struct spi_device *spi)
drivers/iio/dac/ad5791.c+0−1
@@ -340,7 +340,6 @@ static int ad5791_write_raw(struct iio_dev *indio_dev, · 339 unmodified lines
340340 static const struct iio_info ad5791_info = {
341341 .read_raw = &ad5791_read_raw,
342342 .write_raw = &ad5791_write_raw,
343− .driver_module = THIS_MODULE,
344343 };
345344
346345 static int ad5791_probe(struct spi_device *spi)
drivers/iio/dac/ad7303.c+0−1
@@ -161,7 +161,6 @@ static int ad7303_write_raw(struct iio_dev *indio_dev, · 160 unmodified lines
161161 static const struct iio_info ad7303_info = {
162162 .read_raw = ad7303_read_raw,
163163 .write_raw = ad7303_write_raw,
164− .driver_module = THIS_MODULE,
165164 };
166165
167166 static const struct iio_chan_spec_ext_info ad7303_ext_info[] = {
drivers/iio/dac/ad8801.c+0−1
@@ -92,7 +92,6 @@ static int ad8801_read_raw(struct iio_dev *indio_dev, · 91 unmodified lines
9292 static const struct iio_info ad8801_info = {
9393 .read_raw = ad8801_read_raw,
9494 .write_raw = ad8801_write_raw,
95− .driver_module = THIS_MODULE,
9695 };
9796
9897 #define AD8801_CHANNEL(chan) { \
drivers/iio/dac/cio-dac.c+0−1
@@ -85,7 +85,6 @@ static int cio_dac_write_raw(struct iio_dev *indio_dev, · 84 unmodified lines
8585 }
8686
8787 static const struct iio_info cio_dac_info = {
88− .driver_module = THIS_MODULE,
8988 .read_raw = cio_dac_read_raw,
9089 .write_raw = cio_dac_write_raw
9190 };
drivers/iio/dac/dpot-dac.c+0−1
@@ -128,7 +128,6 @@ static const struct iio_info dpot_dac_info = { · 127 unmodified lines
128128 .read_raw = dpot_dac_read_raw,
129129 .read_avail = dpot_dac_read_avail,
130130 .write_raw = dpot_dac_write_raw,
131− .driver_module = THIS_MODULE,
132131 };
133132
134133 static int dpot_dac_channel_max_ohms(struct iio_dev *indio_dev)
drivers/iio/dac/ds4424.c+341−0
@@ -0,0 +1,341 @@
1+/*
2+ * Maxim Integrated
3+ * 7-bit, Multi-Channel Sink/Source Current DAC Driver
4+ * Copyright (C) 2017 Maxim Integrated
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License version 2 as
8+ * published by the Free Software Foundation.
9+ */
10+
11+#include <linux/kernel.h>
12+#include <linux/module.h>
13+#include <linux/i2c.h>
14+#include <linux/regulator/consumer.h>
15+#include <linux/err.h>
16+#include <linux/delay.h>
17+#include <linux/iio/iio.h>
18+#include <linux/iio/driver.h>
19+#include <linux/iio/machine.h>
20+#include <linux/iio/consumer.h>
21+
22+#define DS4422_MAX_DAC_CHANNELS 2
23+#define DS4424_MAX_DAC_CHANNELS 4
24+
25+#define DS4424_DAC_ADDR(chan) ((chan) + 0xf8)
26+#define DS4424_SOURCE_I 1
27+#define DS4424_SINK_I 0
28+
29+#define DS4424_CHANNEL(chan) { \
30+ .type = IIO_CURRENT, \
31+ .indexed = 1, \
32+ .output = 1, \
33+ .channel = chan, \
34+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
35+}
36+
37+/*
38+ * DS4424 DAC control register 8 bits
39+ * [7] 0: to sink; 1: to source
40+ * [6:0] steps to sink/source
41+ * bit[7] looks like a sign bit, but the value of the register is
42+ * not a two's complement code considering the bit[6:0] is a absolute
43+ * distance from the zero point.
44+ */
45+union ds4424_raw_data {
46+ struct {
47+ u8 dx:7;
48+ u8 source_bit:1;
49+ };
50+ u8 bits;
51+};
52+
53+enum ds4424_device_ids {
54+ ID_DS4422,
55+ ID_DS4424,
56+};
57+
58+struct ds4424_data {
59+ struct i2c_client *client;
60+ struct mutex lock;
61+ uint8_t save[DS4424_MAX_DAC_CHANNELS];
62+ struct regulator *vcc_reg;
63+ uint8_t raw[DS4424_MAX_DAC_CHANNELS];
64+};
65+
66+static const struct iio_chan_spec ds4424_channels[] = {
67+ DS4424_CHANNEL(0),
68+ DS4424_CHANNEL(1),
69+ DS4424_CHANNEL(2),
70+ DS4424_CHANNEL(3),
71+};
72+
73+static int ds4424_get_value(struct iio_dev *indio_dev,
74+ int *val, int channel)
75+{
76+ struct ds4424_data *data = iio_priv(indio_dev);
77+ int ret;
78+
79+ mutex_lock(&data->lock);
80+ ret = i2c_smbus_read_byte_data(data->client, DS4424_DAC_ADDR(channel));
81+ if (ret < 0)
82+ goto fail;
83+
84+ *val = ret;
85+
86+fail:
87+ mutex_unlock(&data->lock);
88+ return ret;
89+}
90+
91+static int ds4424_set_value(struct iio_dev *indio_dev,
92+ int val, struct iio_chan_spec const *chan)
93+{
94+ struct ds4424_data *data = iio_priv(indio_dev);
95+ int ret;
96+
97+ mutex_lock(&data->lock);
98+ ret = i2c_smbus_write_byte_data(data->client,
99+ DS4424_DAC_ADDR(chan->channel), val);
100+ if (ret < 0)
101+ goto fail;
102+
103+ data->raw[chan->channel] = val;
104+
105+fail:
106+ mutex_unlock(&data->lock);
107+ return ret;
108+}
109+
110+static int ds4424_read_raw(struct iio_dev *indio_dev,
111+ struct iio_chan_spec const *chan,
112+ int *val, int *val2, long mask)
113+{
114+ union ds4424_raw_data raw;
115+ int ret;
116+
117+ switch (mask) {
118+ case IIO_CHAN_INFO_RAW:
119+ ret = ds4424_get_value(indio_dev, val, chan->channel);
120+ if (ret < 0) {
121+ pr_err("%s : ds4424_get_value returned %d\n",
122+ __func__, ret);
123+ return ret;
124+ }
125+ raw.bits = *val;
126+ *val = raw.dx;
127+ if (raw.source_bit == DS4424_SINK_I)
128+ *val = -*val;
129+ return IIO_VAL_INT;
130+
131+ default:
132+ return -EINVAL;
133+ }
134+}
135+
136+static int ds4424_write_raw(struct iio_dev *indio_dev,
137+ struct iio_chan_spec const *chan,
138+ int val, int val2, long mask)
139+{
140+ union ds4424_raw_data raw;
141+
142+ if (val2 != 0)
143+ return -EINVAL;
144+
145+ switch (mask) {
146+ case IIO_CHAN_INFO_RAW:
147+ if (val < S8_MIN || val > S8_MAX)
148+ return -EINVAL;
149+
150+ if (val > 0) {
151+ raw.source_bit = DS4424_SOURCE_I;
152+ raw.dx = val;
153+ } else {
154+ raw.source_bit = DS4424_SINK_I;
155+ raw.dx = -val;
156+ }
157+
158+ return ds4424_set_value(indio_dev, raw.bits, chan);
159+
160+ default:
161+ return -EINVAL;
162+ }
163+}
164+
165+static int ds4424_verify_chip(struct iio_dev *indio_dev)
166+{
167+ int ret, val;
168+
169+ ret = ds4424_get_value(indio_dev, &val, DS4424_DAC_ADDR(0));
170+ if (ret < 0)
171+ dev_err(&indio_dev->dev,
172+ "%s failed. ret: %d\n", __func__, ret);
173+
174+ return ret;
175+}
176+
177+static int __maybe_unused ds4424_suspend(struct device *dev)
178+{
179+ struct i2c_client *client = to_i2c_client(dev);
180+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
181+ struct ds4424_data *data = iio_priv(indio_dev);
182+ int ret = 0;
183+ int i;
184+
185+ for (i = 0; i < indio_dev->num_channels; i++) {
186+ data->save[i] = data->raw[i];
187+ ret = ds4424_set_value(indio_dev, 0,
188+ &indio_dev->channels[i]);
189+ if (ret < 0)
190+ return ret;
191+ }
192+ return ret;
193+}
194+
195+static int __maybe_unused ds4424_resume(struct device *dev)
196+{
197+ struct i2c_client *client = to_i2c_client(dev);
198+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
199+ struct ds4424_data *data = iio_priv(indio_dev);
200+ int ret = 0;
201+ int i;
202+
203+ for (i = 0; i < indio_dev->num_channels; i++) {
204+ ret = ds4424_set_value(indio_dev, data->save[i],
205+ &indio_dev->channels[i]);
206+ if (ret < 0)
207+ return ret;
208+ }
209+ return ret;
210+}
211+
212+static SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
213+
214+static const struct iio_info ds4424_info = {
215+ .read_raw = ds4424_read_raw,
216+ .write_raw = ds4424_write_raw,
217+};
218+
219+static int ds4424_probe(struct i2c_client *client,
220+ const struct i2c_device_id *id)
221+{
222+ struct ds4424_data *data;
223+ struct iio_dev *indio_dev;
224+ int ret;
225+
226+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
227+ if (!indio_dev) {
228+ dev_err(&client->dev, "iio dev alloc failed.\n");
229+ return -ENOMEM;
230+ }
231+
232+ data = iio_priv(indio_dev);
233+ i2c_set_clientdata(client, indio_dev);
234+ data->client = client;
235+ indio_dev->name = id->name;
236+ indio_dev->dev.of_node = client->dev.of_node;
237+ indio_dev->dev.parent = &client->dev;
238+
239+ if (!client->dev.of_node) {
240+ dev_err(&client->dev,
241+ "Not found DT.\n");
242+ return -ENODEV;
243+ }
244+
245+ data->vcc_reg = devm_regulator_get(&client->dev, "vcc");
246+ if (IS_ERR(data->vcc_reg)) {
247+ dev_err(&client->dev,
248+ "Failed to get vcc-supply regulator. err: %ld\n",
249+ PTR_ERR(data->vcc_reg));
250+ return PTR_ERR(data->vcc_reg);
251+ }
252+
253+ mutex_init(&data->lock);
254+ ret = regulator_enable(data->vcc_reg);
255+ if (ret < 0) {
256+ dev_err(&client->dev,
257+ "Unable to enable the regulator.\n");
258+ return ret;
259+ }
260+
261+ usleep_range(1000, 1200);
262+ ret = ds4424_verify_chip(indio_dev);
263+ if (ret < 0)
264+ goto fail;
265+
266+ switch (id->driver_data) {
267+ case ID_DS4422:
268+ indio_dev->num_channels = DS4422_MAX_DAC_CHANNELS;
269+ break;
270+ case ID_DS4424:
271+ indio_dev->num_channels = DS4424_MAX_DAC_CHANNELS;
272+ break;
273+ default:
274+ dev_err(&client->dev,
275+ "ds4424: Invalid chip id.\n");
276+ ret = -ENXIO;
277+ goto fail;
278+ }
279+
280+ indio_dev->channels = ds4424_channels;
281+ indio_dev->modes = INDIO_DIRECT_MODE;
282+ indio_dev->info = &ds4424_info;
283+
284+ ret = iio_device_register(indio_dev);
285+ if (ret < 0) {
286+ dev_err(&client->dev,
287+ "iio_device_register failed. ret: %d\n", ret);
288+ goto fail;
289+ }
290+
291+ return ret;
292+
293+fail:
294+ regulator_disable(data->vcc_reg);
295+ return ret;
296+}
297+
298+static int ds4424_remove(struct i2c_client *client)
299+{
300+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
301+ struct ds4424_data *data = iio_priv(indio_dev);
302+
303+ iio_device_unregister(indio_dev);
304+ regulator_disable(data->vcc_reg);
305+
306+ return 0;
307+}
308+
309+static const struct i2c_device_id ds4424_id[] = {
310+ { "ds4422", ID_DS4422 },
311+ { "ds4424", ID_DS4424 },
312+ { }
313+};
314+
315+MODULE_DEVICE_TABLE(i2c, ds4424_id);
316+
317+static const struct of_device_id ds4424_of_match[] = {
318+ { .compatible = "maxim,ds4422" },
319+ { .compatible = "maxim,ds4424" },
320+ { },
321+};
322+
323+MODULE_DEVICE_TABLE(of, ds4424_of_match);
324+
325+static struct i2c_driver ds4424_driver = {
326+ .driver = {
327+ .name = "ds4424",
328+ .of_match_table = ds4424_of_match,
329+ .pm = &ds4424_pm_ops,
330+ },
331+ .probe = ds4424_probe,
332+ .remove = ds4424_remove,
333+ .id_table = ds4424_id,
334+};
335+module_i2c_driver(ds4424_driver);
336+
337+MODULE_DESCRIPTION("Maxim DS4424 DAC Driver");
338+MODULE_AUTHOR("Ismail H. Kose <ismail.kose@maximintegrated.com>");
339+MODULE_AUTHOR("Vishal Sood <vishal.sood@maximintegrated.com>");
340+MODULE_AUTHOR("David Jung <david.jung@maximintegrated.com>");
341+MODULE_LICENSE("GPL v2");
drivers/iio/dac/lpc18xx_dac.c+0−1
@@ -103,7 +103,6 @@ static int lpc18xx_dac_write_raw(struct iio_dev *indio_dev, · 102 unmodified lines
103103 static const struct iio_info lpc18xx_dac_info = {
104104 .read_raw = lpc18xx_dac_read_raw,
105105 .write_raw = lpc18xx_dac_write_raw,
106− .driver_module = THIS_MODULE,
107106 };
108107
109108 static int lpc18xx_dac_probe(struct platform_device *pdev)
drivers/iio/dac/ltc2632.c+0−1
@@ -159,7 +159,6 @@ static ssize_t ltc2632_write_dac_powerdown(struct iio_dev *indio_dev, · 158 unmodified lines
159159 static const struct iio_info ltc2632_info = {
160160 .write_raw = ltc2632_write_raw,
161161 .read_raw = ltc2632_read_raw,
162− .driver_module = THIS_MODULE,
163162 };
164163
165164 static const struct iio_chan_spec_ext_info ltc2632_ext_info[] = {
drivers/iio/dac/m62332.c+0−1
@@ -174,7 +174,6 @@ static SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume); · 173 unmodified lines
174174 static const struct iio_info m62332_info = {
175175 .read_raw = m62332_read_raw,
176176 .write_raw = m62332_write_raw,
177− .driver_module = THIS_MODULE,
178177 };
179178
180179 #define M62332_CHANNEL(chan) { \
drivers/iio/dac/max517.c+0−1
@@ -137,7 +137,6 @@ static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); · 136 unmodified lines
137137 static const struct iio_info max517_info = {
138138 .read_raw = max517_read_raw,
139139 .write_raw = max517_write_raw,
140− .driver_module = THIS_MODULE,
141140 };
142141
143142 #define MAX517_CHANNEL(chan) { \
drivers/iio/dac/max5821.c+0−1
@@ -300,7 +300,6 @@ static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume); · 299 unmodified lines
300300 static const struct iio_info max5821_info = {
301301 .read_raw = max5821_read_raw,
302302 .write_raw = max5821_write_raw,
303− .driver_module = THIS_MODULE,
304303 };
305304
306305 static int max5821_probe(struct i2c_client *client,
drivers/iio/dac/mcp4725.c+0−1
@@ -363,7 +363,6 @@ static const struct iio_info mcp4725_info = { · 362 unmodified lines
363363 .read_raw = mcp4725_read_raw,
364364 .write_raw = mcp4725_write_raw,
365365 .attrs = &mcp4725_attribute_group,
366− .driver_module = THIS_MODULE,
367366 };
368367
369368 #ifdef CONFIG_OF
drivers/iio/dac/mcp4922.c+0−1
@@ -119,7 +119,6 @@ static const struct iio_chan_spec mcp4922_channels[3][MCP4922_NUM_CHANNELS] = { · 118 unmodified lines
119119 static const struct iio_info mcp4922_info = {
120120 .read_raw = &mcp4922_read_raw,
121121 .write_raw = &mcp4922_write_raw,
122− .driver_module = THIS_MODULE,
123122 };
124123
125124 static int mcp4922_probe(struct spi_device *spi)
drivers/iio/dac/stm32-dac.c+0−1
@@ -156,7 +156,6 @@ static const struct iio_info stm32_dac_iio_info = { · 155 unmodified lines
156156 .read_raw = stm32_dac_read_raw,
157157 .write_raw = stm32_dac_write_raw,
158158 .debugfs_reg_access = stm32_dac_debugfs_reg_access,
159− .driver_module = THIS_MODULE,
160159 };
161160
162161 static const char * const stm32_dac_powerdown_modes[] = {
drivers/iio/dac/ti-dac082s085.c+368−0
@@ -0,0 +1,368 @@
1+/*
2+ * ti-dac082s085.c - Texas Instruments 8/10/12-bit 2/4-channel DAC driver
3+ *
4+ * Copyright (C) 2017 KUNBUS GmbH
5+ *
6+ * http://www.ti.com/lit/ds/symlink/dac082s085.pdf
7+ * http://www.ti.com/lit/ds/symlink/dac102s085.pdf
8+ * http://www.ti.com/lit/ds/symlink/dac122s085.pdf
9+ * http://www.ti.com/lit/ds/symlink/dac084s085.pdf
10+ * http://www.ti.com/lit/ds/symlink/dac104s085.pdf
11+ * http://www.ti.com/lit/ds/symlink/dac124s085.pdf
12+ *
13+ * This program is free software; you can redistribute it and/or modify
14+ * it under the terms of the GNU General Public License (version 2) as
15+ * published by the Free Software Foundation.
16+ */
17+
18+#include <linux/iio/iio.h>
19+#include <linux/module.h>
20+#include <linux/regulator/consumer.h>
21+#include <linux/spi/spi.h>
22+
23+enum { dual_8bit, dual_10bit, dual_12bit, quad_8bit, quad_10bit, quad_12bit };
24+
25+struct ti_dac_spec {
26+ u8 num_channels;
27+ u8 resolution;
28+};
29+
30+static const struct ti_dac_spec ti_dac_spec[] = {
31+ [dual_8bit] = { .num_channels = 2, .resolution = 8 },
32+ [dual_10bit] = { .num_channels = 2, .resolution = 10 },
33+ [dual_12bit] = { .num_channels = 2, .resolution = 12 },
34+ [quad_8bit] = { .num_channels = 4, .resolution = 8 },
35+ [quad_10bit] = { .num_channels = 4, .resolution = 10 },
36+ [quad_12bit] = { .num_channels = 4, .resolution = 12 },
37+};
38+
39+/**
40+ * struct ti_dac_chip - TI DAC chip
41+ * @lock: protects write sequences
42+ * @vref: regulator generating Vref
43+ * @mesg: SPI message to perform a write
44+ * @xfer: SPI transfer used by @mesg
45+ * @val: cached value of each output
46+ * @powerdown: whether the chip is powered down
47+ * @powerdown_mode: selected by the user
48+ * @resolution: resolution of the chip
49+ * @buf: buffer for @xfer
50+ */
51+struct ti_dac_chip {
52+ struct mutex lock;
53+ struct regulator *vref;
54+ struct spi_message mesg;
55+ struct spi_transfer xfer;
56+ u16 val[4];
57+ bool powerdown;
58+ u8 powerdown_mode;
59+ u8 resolution;
60+ u8 buf[2] ____cacheline_aligned;
61+};
62+
63+#define WRITE_NOT_UPDATE(chan) (0x00 | (chan) << 6)
64+#define WRITE_AND_UPDATE(chan) (0x10 | (chan) << 6)
65+#define WRITE_ALL_UPDATE 0x20
66+#define POWERDOWN(mode) (0x30 | ((mode) + 1) << 6)
67+
68+static int ti_dac_cmd(struct ti_dac_chip *ti_dac, u8 cmd, u16 val)
69+{
70+ u8 shift = 12 - ti_dac->resolution;
71+
72+ ti_dac->buf[0] = cmd | (val >> (8 - shift));
73+ ti_dac->buf[1] = (val << shift) & 0xff;
74+ return spi_sync(ti_dac->mesg.spi, &ti_dac->mesg);
75+}
76+
77+static const char * const ti_dac_powerdown_modes[] = {
78+ "2.5kohm_to_gnd", "100kohm_to_gnd", "three_state",
79+};
80+
81+static int ti_dac_get_powerdown_mode(struct iio_dev *indio_dev,
82+ const struct iio_chan_spec *chan)
83+{
84+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
85+
86+ return ti_dac->powerdown_mode;
87+}
88+
89+static int ti_dac_set_powerdown_mode(struct iio_dev *indio_dev,
90+ const struct iio_chan_spec *chan,
91+ unsigned int mode)
92+{
93+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
94+ int ret = 0;
95+
96+ if (ti_dac->powerdown_mode == mode)
97+ return 0;
98+
99+ mutex_lock(&ti_dac->lock);
100+ if (ti_dac->powerdown) {
101+ ret = ti_dac_cmd(ti_dac, POWERDOWN(mode), 0);
102+ if (ret)
103+ goto out;
104+ }
105+ ti_dac->powerdown_mode = mode;
106+
107+out:
108+ mutex_unlock(&ti_dac->lock);
109+ return ret;
110+}
111+
112+static const struct iio_enum ti_dac_powerdown_mode = {
113+ .items = ti_dac_powerdown_modes,
114+ .num_items = ARRAY_SIZE(ti_dac_powerdown_modes),
115+ .get = ti_dac_get_powerdown_mode,
116+ .set = ti_dac_set_powerdown_mode,
117+};
118+
119+static ssize_t ti_dac_read_powerdown(struct iio_dev *indio_dev,
120+ uintptr_t private,
121+ const struct iio_chan_spec *chan,
122+ char *buf)
123+{
124+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
125+
126+ return sprintf(buf, "%d\n", ti_dac->powerdown);
127+}
128+
129+static ssize_t ti_dac_write_powerdown(struct iio_dev *indio_dev,
130+ uintptr_t private,
131+ const struct iio_chan_spec *chan,
132+ const char *buf, size_t len)
133+{
134+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
135+ bool powerdown;
136+ int ret;
137+
138+ ret = strtobool(buf, &powerdown);
139+ if (ret)
140+ return ret;
141+
142+ if (ti_dac->powerdown == powerdown)
143+ return len;
144+
145+ mutex_lock(&ti_dac->lock);
146+ if (powerdown)
147+ ret = ti_dac_cmd(ti_dac, POWERDOWN(ti_dac->powerdown_mode), 0);
148+ else
149+ ret = ti_dac_cmd(ti_dac, WRITE_AND_UPDATE(0), ti_dac->val[0]);
150+ if (!ret)
151+ ti_dac->powerdown = powerdown;
152+ mutex_unlock(&ti_dac->lock);
153+
154+ return ret ? ret : len;
155+}
156+
157+static const struct iio_chan_spec_ext_info ti_dac_ext_info[] = {
158+ {
159+ .name = "powerdown",
160+ .read = ti_dac_read_powerdown,
161+ .write = ti_dac_write_powerdown,
162+ .shared = IIO_SHARED_BY_TYPE,
163+ },
164+ IIO_ENUM("powerdown_mode", IIO_SHARED_BY_TYPE, &ti_dac_powerdown_mode),
165+ IIO_ENUM_AVAILABLE("powerdown_mode", &ti_dac_powerdown_mode),
166+ { },
167+};
168+
169+#define TI_DAC_CHANNEL(chan) { \
170+ .type = IIO_VOLTAGE, \
171+ .channel = (chan), \
172+ .address = (chan), \
173+ .indexed = true, \
174+ .output = true, \
175+ .datasheet_name = (const char[]){ 'A' + (chan), 0 }, \
176+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
177+ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
178+ .ext_info = ti_dac_ext_info, \
179+}
180+
181+static const struct iio_chan_spec ti_dac_channels[] = {
182+ TI_DAC_CHANNEL(0),
183+ TI_DAC_CHANNEL(1),
184+ TI_DAC_CHANNEL(2),
185+ TI_DAC_CHANNEL(3),
186+};
187+
188+static int ti_dac_read_raw(struct iio_dev *indio_dev,
189+ struct iio_chan_spec const *chan,
190+ int *val, int *val2, long mask)
191+{
192+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
193+ int ret;
194+
195+ switch (mask) {
196+ case IIO_CHAN_INFO_RAW:
197+ *val = ti_dac->val[chan->channel];
198+ ret = IIO_VAL_INT;
199+ break;
200+
201+ case IIO_CHAN_INFO_SCALE:
202+ ret = regulator_get_voltage(ti_dac->vref);
203+ if (ret < 0)
204+ return ret;
205+
206+ *val = ret / 1000;
207+ *val2 = ti_dac->resolution;
208+ ret = IIO_VAL_FRACTIONAL_LOG2;
209+ break;
210+
211+ default:
212+ ret = -EINVAL;
213+ }
214+
215+ return ret;
216+}
217+
218+static int ti_dac_write_raw(struct iio_dev *indio_dev,
219+ struct iio_chan_spec const *chan,
220+ int val, int val2, long mask)
221+{
222+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
223+ int ret;
224+
225+ switch (mask) {
226+ case IIO_CHAN_INFO_RAW:
227+ if (ti_dac->val[chan->channel] == val)
228+ return 0;
229+
230+ if (val >= (1 << ti_dac->resolution) || val < 0)
231+ return -EINVAL;
232+
233+ if (ti_dac->powerdown)
234+ return -EBUSY;
235+
236+ mutex_lock(&ti_dac->lock);
237+ ret = ti_dac_cmd(ti_dac, WRITE_AND_UPDATE(chan->channel), val);
238+ if (!ret)
239+ ti_dac->val[chan->channel] = val;
240+ mutex_unlock(&ti_dac->lock);
241+ break;
242+
243+ default:
244+ ret = -EINVAL;
245+ }
246+
247+ return ret;
248+}
249+
250+static int ti_dac_write_raw_get_fmt(struct iio_dev *indio_dev,
251+ struct iio_chan_spec const *chan, long mask)
252+{
253+ return IIO_VAL_INT;
254+}
255+
256+static const struct iio_info ti_dac_info = {
257+ .read_raw = ti_dac_read_raw,
258+ .write_raw = ti_dac_write_raw,
259+ .write_raw_get_fmt = ti_dac_write_raw_get_fmt,
260+};
261+
262+static int ti_dac_probe(struct spi_device *spi)
263+{
264+ struct device *dev = &spi->dev;
265+ const struct ti_dac_spec *spec;
266+ struct ti_dac_chip *ti_dac;
267+ struct iio_dev *indio_dev;
268+ int ret;
269+
270+ indio_dev = devm_iio_device_alloc(dev, sizeof(*ti_dac));
271+ if (!indio_dev)
272+ return -ENOMEM;
273+
274+ indio_dev->dev.parent = dev;
275+ indio_dev->info = &ti_dac_info;
276+ indio_dev->name = spi->modalias;
277+ indio_dev->modes = INDIO_DIRECT_MODE;
278+ indio_dev->channels = ti_dac_channels;
279+ spi_set_drvdata(spi, indio_dev);
280+
281+ ti_dac = iio_priv(indio_dev);
282+ ti_dac->xfer.tx_buf = &ti_dac->buf;
283+ ti_dac->xfer.len = sizeof(ti_dac->buf);
284+ spi_message_init_with_transfers(&ti_dac->mesg, &ti_dac->xfer, 1);
285+ ti_dac->mesg.spi = spi;
286+
287+ spec = &ti_dac_spec[spi_get_device_id(spi)->driver_data];
288+ indio_dev->num_channels = spec->num_channels;
289+ ti_dac->resolution = spec->resolution;
290+
291+ ti_dac->vref = devm_regulator_get(dev, "vref");
292+ if (IS_ERR(ti_dac->vref))
293+ return PTR_ERR(ti_dac->vref);
294+
295+ ret = regulator_enable(ti_dac->vref);
296+ if (ret < 0)
297+ return ret;
298+
299+ mutex_init(&ti_dac->lock);
300+
301+ ret = ti_dac_cmd(ti_dac, WRITE_ALL_UPDATE, 0);
302+ if (ret) {
303+ dev_err(dev, "failed to initialize outputs to 0\n");
304+ goto err;
305+ }
306+
307+ ret = iio_device_register(indio_dev);
308+ if (ret)
309+ goto err;
310+
311+ return 0;
312+
313+err:
314+ mutex_destroy(&ti_dac->lock);
315+ regulator_disable(ti_dac->vref);
316+ return ret;
317+}
318+
319+static int ti_dac_remove(struct spi_device *spi)
320+{
321+ struct iio_dev *indio_dev = spi_get_drvdata(spi);
322+ struct ti_dac_chip *ti_dac = iio_priv(indio_dev);
323+
324+ iio_device_unregister(indio_dev);
325+ mutex_destroy(&ti_dac->lock);
326+ regulator_disable(ti_dac->vref);
327+
328+ return 0;
329+}
330+
331+#ifdef CONFIG_OF
332+static const struct of_device_id ti_dac_of_id[] = {
333+ { .compatible = "ti,dac082s085" },
334+ { .compatible = "ti,dac102s085" },
335+ { .compatible = "ti,dac122s085" },
336+ { .compatible = "ti,dac084s085" },
337+ { .compatible = "ti,dac104s085" },
338+ { .compatible = "ti,dac124s085" },
339+ { }
340+};
341+MODULE_DEVICE_TABLE(of, ti_dac_of_id);
342+#endif
343+
344+static const struct spi_device_id ti_dac_spi_id[] = {
345+ { "dac082s085", dual_8bit },
346+ { "dac102s085", dual_10bit },
347+ { "dac122s085", dual_12bit },
348+ { "dac084s085", quad_8bit },
349+ { "dac104s085", quad_10bit },
350+ { "dac124s085", quad_12bit },
351+ { }
352+};
353+MODULE_DEVICE_TABLE(spi, ti_dac_spi_id);
354+
355+static struct spi_driver ti_dac_driver = {
356+ .driver = {
357+ .name = "ti-dac082s085",
358+ .of_match_table = of_match_ptr(ti_dac_of_id),
359+ },
360+ .probe = ti_dac_probe,
361+ .remove = ti_dac_remove,
362+ .id_table = ti_dac_spi_id,
363+};
364+module_spi_driver(ti_dac_driver);
365+
366+MODULE_AUTHOR("Lukas Wunner <lukas@wunner.de>");
367+MODULE_DESCRIPTION("Texas Instruments 8/10/12-bit 2/4-channel DAC driver");
368+MODULE_LICENSE("GPL v2");
drivers/iio/dac/vf610_dac.c+0−1
@@ -167,7 +167,6 @@ static int vf610_write_raw(struct iio_dev *indio_dev, · 166 unmodified lines
167167 }
168168
169169 static const struct iio_info vf610_dac_iio_info = {
170− .driver_module = THIS_MODULE,
171170 .read_raw = &vf610_read_raw,
172171 .write_raw = &vf610_write_raw,
173172 };
drivers/iio/dummy/Kconfig+1−1
@@ -5,7 +5,7 @@ menu "IIO dummy driver" · 4 unmodified lines
55 depends on IIO
66
77 config IIO_DUMMY_EVGEN
8− select IRQ_WORK
8+ select IRQ_SIM
99 tristate
1010
1111 config IIO_SIMPLE_DUMMY
drivers/iio/dummy/iio_dummy_evgen.c+19−70
@@ -24,97 +24,46 @@ · 23 unmodified lines
2424 #include "iio_dummy_evgen.h"
2525 #include <linux/iio/iio.h>
2626 #include <linux/iio/sysfs.h>
27−#include <linux/irq_work.h>
27+#include <linux/irq_sim.h>
2828
2929 /* Fiddly bit of faking and irq without hardware */
3030 #define IIO_EVENTGEN_NO 10
3131
3232 /**
33− * struct iio_dummy_handle_irq - helper struct to simulate interrupt generation
34− * @work: irq_work used to run handlers from hardirq context
35− * @irq: fake irq line number to trigger an interrupt
36− */
37−struct iio_dummy_handle_irq {
38− struct irq_work work;
39− int irq;
40−};
41−
42−/**
43− * struct iio_dummy_evgen - evgen state
44− * @chip: irq chip we are faking
45− * @base: base of irq range
46− * @enabled: mask of which irqs are enabled
47− * @inuse: mask of which irqs are connected
4833 * @regs: irq regs we are faking
4934 * @lock: protect the evgen state
50− * @handler: helper for a 'hardware-like' interrupt simulation
35+ * @inuse: mask of which irqs are connected
36+ * @irq_sim: interrupt simulator
37+ * @base: base of irq range
5138 */
5239 struct iio_dummy_eventgen {
53− struct irq_chip chip;
54− int base;
55− bool enabled[IIO_EVENTGEN_NO];
56− bool inuse[IIO_EVENTGEN_NO];
5740 struct iio_dummy_regs regs[IIO_EVENTGEN_NO];
5841 struct mutex lock;
59− struct iio_dummy_handle_irq handler;
42+ bool inuse[IIO_EVENTGEN_NO];
43+ struct irq_sim irq_sim;
44+ int base;
6045 };
6146
6247 /* We can only ever have one instance of this 'device' */
6348 static struct iio_dummy_eventgen *iio_evgen;
64−static const char *iio_evgen_name = "iio_dummy_evgen";
65−
66−static void iio_dummy_event_irqmask(struct irq_data *d)
67−{
68− struct irq_chip *chip = irq_data_get_irq_chip(d);
69− struct iio_dummy_eventgen *evgen =
70− container_of(chip, struct iio_dummy_eventgen, chip);
71−
72− evgen->enabled[d->irq - evgen->base] = false;
73−}
74−
75−static void iio_dummy_event_irqunmask(struct irq_data *d)
76−{
77− struct irq_chip *chip = irq_data_get_irq_chip(d);
78− struct iio_dummy_eventgen *evgen =
79− container_of(chip, struct iio_dummy_eventgen, chip);
80−
81− evgen->enabled[d->irq - evgen->base] = true;
82−}
83−
84−static void iio_dummy_work_handler(struct irq_work *work)
85−{
86− struct iio_dummy_handle_irq *irq_handler;
87−
88− irq_handler = container_of(work, struct iio_dummy_handle_irq, work);
89− handle_simple_irq(irq_to_desc(irq_handler->irq));
90−}
9149
9250 static int iio_dummy_evgen_create(void)
9351 {
94− int ret, i;
52+ int ret;
9553
9654 iio_evgen = kzalloc(sizeof(*iio_evgen), GFP_KERNEL);
9755 if (!iio_evgen)
9856 return -ENOMEM;
9957
100− iio_evgen->base = irq_alloc_descs(-1, 0, IIO_EVENTGEN_NO, 0);
101− if (iio_evgen->base < 0) {
102− ret = iio_evgen->base;
58+ ret = irq_sim_init(&iio_evgen->irq_sim, IIO_EVENTGEN_NO);
59+ if (ret) {
10360 kfree(iio_evgen);
10461 return ret;
10562 }
106− iio_evgen->chip.name = iio_evgen_name;
107− iio_evgen->chip.irq_mask = &iio_dummy_event_irqmask;
108− iio_evgen->chip.irq_unmask = &iio_dummy_event_irqunmask;
109− for (i = 0; i < IIO_EVENTGEN_NO; i++) {
110− irq_set_chip(iio_evgen->base + i, &iio_evgen->chip);
111− irq_set_handler(iio_evgen->base + i, &handle_simple_irq);
112− irq_modify_status(iio_evgen->base + i,
113− IRQ_NOREQUEST | IRQ_NOAUTOEN,
114− IRQ_NOPROBE);
115− }
116− init_irq_work(&iio_evgen->handler.work, iio_dummy_work_handler);
63+
64+ iio_evgen->base = irq_sim_irqnum(&iio_evgen->irq_sim, 0);
11765 mutex_init(&iio_evgen->lock);
66+
11867 return 0;
11968 }
12069
@@ -132,15 +81,17 @@ int iio_dummy_evgen_get_irq(void) · 11 unmodified lines
13281 return -ENODEV;
13382
13483 mutex_lock(&iio_evgen->lock);
135− for (i = 0; i < IIO_EVENTGEN_NO; i++)
84+ for (i = 0; i < IIO_EVENTGEN_NO; i++) {
13685 if (!iio_evgen->inuse[i]) {
137− ret = iio_evgen->base + i;
86+ ret = irq_sim_irqnum(&iio_evgen->irq_sim, i);
13887 iio_evgen->inuse[i] = true;
13988 break;
14089 }
90+ }
14191 mutex_unlock(&iio_evgen->lock);
14292 if (i == IIO_EVENTGEN_NO)
14393 return -ENOMEM;
94+
14495 return ret;
14596 }
14697 EXPORT_SYMBOL_GPL(iio_dummy_evgen_get_irq);
@@ -167,7 +118,7 @@ EXPORT_SYMBOL_GPL(iio_dummy_evgen_get_regs); · 20 unmodified lines
167118
168119 static void iio_dummy_evgen_free(void)
169120 {
170− irq_free_descs(iio_evgen->base, IIO_EVENTGEN_NO);
121+ irq_sim_fini(&iio_evgen->irq_sim);
171122 kfree(iio_evgen);
172123 }
173124
@@ -192,9 +143,7 @@ static ssize_t iio_evgen_poke(struct device *dev, · 18 unmodified lines
192143 iio_evgen->regs[this_attr->address].reg_id = this_attr->address;
193144 iio_evgen->regs[this_attr->address].reg_data = event;
194145
195− iio_evgen->handler.irq = iio_evgen->base + this_attr->address;
196− if (iio_evgen->enabled[this_attr->address])
197− irq_work_queue(&iio_evgen->handler.work);
146+ irq_sim_fire(&iio_evgen->irq_sim, this_attr->address);
198147
199148 return len;
200149 }
drivers/iio/dummy/iio_simple_dummy.c+0−1
@@ -519,7 +519,6 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev, · 518 unmodified lines
519519 * Device type specific information.
520520 */
521521 static const struct iio_info iio_dummy_info = {
522− .driver_module = THIS_MODULE,
523522 .read_raw = &iio_dummy_read_raw,
524523 .write_raw = &iio_dummy_write_raw,
525524 #ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
drivers/iio/frequency/ad9523.c+0−1
@@ -738,7 +738,6 @@ static const struct iio_info ad9523_info = { · 737 unmodified lines
738738 .write_raw = &ad9523_write_raw,
739739 .debugfs_reg_access = &ad9523_reg_access,
740740 .attrs = &ad9523_attribute_group,
741− .driver_module = THIS_MODULE,
742741 };
743742
744743 static int ad9523_setup(struct iio_dev *indio_dev)
drivers/iio/frequency/adf4350.c+0−1
@@ -374,7 +374,6 @@ static const struct iio_chan_spec adf4350_chan = { · 373 unmodified lines
374374
375375 static const struct iio_info adf4350_info = {
376376 .debugfs_reg_access = &adf4350_reg_access,
377− .driver_module = THIS_MODULE,
378377 };
379378
380379 #ifdef CONFIG_OF
drivers/iio/gyro/adis16080.c+0−1
@@ -163,7 +163,6 @@ static const struct iio_chan_spec adis16080_channels[] = { · 162 unmodified lines
163163
164164 static const struct iio_info adis16080_info = {
165165 .read_raw = &adis16080_read_raw,
166− .driver_module = THIS_MODULE,
167166 };
168167
169168 enum {
drivers/iio/gyro/adis16130.c+0−1
@@ -137,7 +137,6 @@ static const struct iio_chan_spec adis16130_channels[] = { · 136 unmodified lines
137137
138138 static const struct iio_info adis16130_info = {
139139 .read_raw = &adis16130_read_raw,
140− .driver_module = THIS_MODULE,
141140 };
142141
143142 static int adis16130_probe(struct spi_device *spi)
drivers/iio/gyro/adis16136.c+0−1
@@ -398,7 +398,6 @@ static const struct attribute_group adis16136_attribute_group = { · 397 unmodified lines
398398 };
399399
400400 static const struct iio_info adis16136_info = {
401− .driver_module = THIS_MODULE,
402401 .attrs = &adis16136_attribute_group,
403402 .read_raw = &adis16136_read_raw,
404403 .write_raw = &adis16136_write_raw,
drivers/iio/gyro/adis16260.c+0−1
@@ -321,7 +321,6 @@ static const struct iio_info adis16260_info = { · 320 unmodified lines
321321 .read_raw = &adis16260_read_raw,
322322 .write_raw = &adis16260_write_raw,
323323 .update_scan_mode = adis_update_scan_mode,
324− .driver_module = THIS_MODULE,
325324 };
326325
327326 static const char * const adis1620_status_error_msgs[] = {
drivers/iio/gyro/adxrs450.c+0−1
@@ -405,7 +405,6 @@ static const struct iio_chan_spec adxrs450_channels[2][2] = { · 404 unmodified lines
405405 };
406406
407407 static const struct iio_info adxrs450_info = {
408− .driver_module = THIS_MODULE,
409408 .read_raw = &adxrs450_read_raw,
410409 .write_raw = &adxrs450_write_raw,
411410 };
drivers/iio/gyro/bmg160_core.c+0−2
@@ -858,7 +858,6 @@ static const struct iio_info bmg160_info = { · 857 unmodified lines
858858 .write_event_value = bmg160_write_event,
859859 .write_event_config = bmg160_write_event_config,
860860 .read_event_config = bmg160_read_event_config,
861− .driver_module = THIS_MODULE,
862861 };
863862
864863 static const unsigned long bmg160_accel_scan_masks[] = {
@@ -956,7 +955,6 @@ static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, · 91 unmodified lines
956955 static const struct iio_trigger_ops bmg160_trigger_ops = {
957956 .set_trigger_state = bmg160_data_rdy_trigger_set_state,
958957 .try_reenable = bmg160_trig_try_reen,
959− .owner = THIS_MODULE,
960958 };
961959
962960 static irqreturn_t bmg160_event_handler(int irq, void *private)
drivers/iio/gyro/hid-sensor-gyro-3d.c+0−1
@@ -186,7 +186,6 @@ static int gyro_3d_write_raw(struct iio_dev *indio_dev, · 185 unmodified lines
186186 }
187187
188188 static const struct iio_info gyro_3d_info = {
189− .driver_module = THIS_MODULE,
190189 .read_raw = &gyro_3d_read_raw,
191190 .write_raw = &gyro_3d_write_raw,
192191 };
drivers/iio/gyro/itg3200_buffer.c+0−1
@@ -101,7 +101,6 @@ error_ret: · 100 unmodified lines
101101 }
102102
103103 static const struct iio_trigger_ops itg3200_trigger_ops = {
104− .owner = THIS_MODULE,
105104 .set_trigger_state = &itg3200_data_rdy_trigger_set_state,
106105 };
107106
drivers/iio/gyro/itg3200_core.c+0−1
@@ -278,7 +278,6 @@ static const struct iio_chan_spec itg3200_channels[] = { · 277 unmodified lines
278278 static const struct iio_info itg3200_info = {
279279 .read_raw = &itg3200_read_raw,
280280 .write_raw = &itg3200_write_raw,
281− .driver_module = THIS_MODULE,
282281 };
283282
284283 static const unsigned long itg3200_available_scan_masks[] = { 0xffffffff, 0x0 };
drivers/iio/gyro/mpu3050-core.c+0−2
@@ -742,7 +742,6 @@ static const struct attribute_group mpu3050_attribute_group = { · 741 unmodified lines
742742 };
743743
744744 static const struct iio_info mpu3050_info = {
745− .driver_module = THIS_MODULE,
746745 .read_raw = mpu3050_read_raw,
747746 .write_raw = mpu3050_write_raw,
748747 .attrs = &mpu3050_attribute_group,
@@ -1032,7 +1031,6 @@ static int mpu3050_drdy_trigger_set_state(struct iio_trigger *trig, · 283 unmodified lines
10321031 }
10331032
10341033 static const struct iio_trigger_ops mpu3050_trigger_ops = {
1035− .owner = THIS_MODULE,
10361034 .set_trigger_state = mpu3050_drdy_trigger_set_state,
10371035 };
10381036
drivers/iio/gyro/st_gyro_core.c+36−11
@@ -111,14 +111,23 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { · 110 unmodified lines
111111 .mask = 0x80,
112112 },
113113 .drdy_irq = {
114− .addr = 0x22,
115− .mask_int2 = 0x08,
114+ .int2 = {
115+ .addr = 0x22,
116+ .mask = 0x08,
117+ },
116118 /*
117119 * The sensor has IHL (active low) and open
118120 * drain settings, but only for INT1 and not
119121 * for the DRDY line on INT2.
120122 */
121− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
123+ .stat_drdy = {
124+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
125+ .mask = 0x07,
126+ },
127+ },
128+ .sim = {
129+ .addr = 0x23,
130+ .value = BIT(0),
122131 },
123132 .multi_read_bit = true,
124133 .bootime = 2,
@@ -181,14 +190,23 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { · 56 unmodified lines
181190 .mask = 0x80,
182191 },
183192 .drdy_irq = {
184− .addr = 0x22,
185− .mask_int2 = 0x08,
193+ .int2 = {
194+ .addr = 0x22,
195+ .mask = 0x08,
196+ },
186197 /*
187198 * The sensor has IHL (active low) and open
188199 * drain settings, but only for INT1 and not
189200 * for the DRDY line on INT2.
190201 */
191− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
202+ .stat_drdy = {
203+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
204+ .mask = 0x07,
205+ },
206+ },
207+ .sim = {
208+ .addr = 0x23,
209+ .value = BIT(0),
192210 },
193211 .multi_read_bit = true,
194212 .bootime = 2,
@@ -246,14 +264,23 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { · 51 unmodified lines
246264 .mask = 0x80,
247265 },
248266 .drdy_irq = {
249− .addr = 0x22,
250− .mask_int2 = 0x08,
267+ .int2 = {
268+ .addr = 0x22,
269+ .mask = 0x08,
270+ },
251271 /*
252272 * The sensor has IHL (active low) and open
253273 * drain settings, but only for INT1 and not
254274 * for the DRDY line on INT2.
255275 */
256− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
276+ .stat_drdy = {
277+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
278+ .mask = 0x07,
279+ },
280+ },
281+ .sim = {
282+ .addr = 0x23,
283+ .value = BIT(0),
257284 },
258285 .multi_read_bit = true,
259286 .bootime = 2,
@@ -326,7 +353,6 @@ static const struct attribute_group st_gyro_attribute_group = { · 66 unmodified lines
326353 };
327354
328355 static const struct iio_info gyro_info = {
329− .driver_module = THIS_MODULE,
330356 .attrs = &st_gyro_attribute_group,
331357 .read_raw = &st_gyro_read_raw,
332358 .write_raw = &st_gyro_write_raw,
@@ -335,7 +361,6 @@ static const struct iio_info gyro_info = { · 2 unmodified lines
335361
336362 #ifdef CONFIG_IIO_TRIGGER
337363 static const struct iio_trigger_ops st_gyro_trigger_ops = {
338− .owner = THIS_MODULE,
339364 .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE,
340365 .validate_device = st_sensors_validate_device,
341366 };
drivers/iio/health/afe4403.c+0−2
@@ -309,7 +309,6 @@ static const struct iio_info afe4403_iio_info = { · 308 unmodified lines
309309 .attrs = &afe440x_attribute_group,
310310 .read_raw = afe4403_read_raw,
311311 .write_raw = afe4403_write_raw,
312− .driver_module = THIS_MODULE,
313312 };
314313
315314 static irqreturn_t afe4403_trigger_handler(int irq, void *private)
@@ -354,7 +353,6 @@ err: · 38 unmodified lines
354353 }
355354
356355 static const struct iio_trigger_ops afe4403_trigger_ops = {
357− .owner = THIS_MODULE,
358356 };
359357
360358 #define AFE4403_TIMING_PAIRS \
drivers/iio/health/afe4404.c+0−2
@@ -328,7 +328,6 @@ static const struct iio_info afe4404_iio_info = { · 327 unmodified lines
328328 .attrs = &afe440x_attribute_group,
329329 .read_raw = afe4404_read_raw,
330330 .write_raw = afe4404_write_raw,
331− .driver_module = THIS_MODULE,
332331 };
333332
334333 static irqreturn_t afe4404_trigger_handler(int irq, void *private)
@@ -355,7 +354,6 @@ err: · 20 unmodified lines
355354 }
356355
357356 static const struct iio_trigger_ops afe4404_trigger_ops = {
358− .owner = THIS_MODULE,
359357 };
360358
361359 /* Default timings from data-sheet */
drivers/iio/health/max30100.c+0−1
@@ -420,7 +420,6 @@ static int max30100_read_raw(struct iio_dev *indio_dev, · 419 unmodified lines
420420 }
421421
422422 static const struct iio_info max30100_info = {
423− .driver_module = THIS_MODULE,
424423 .read_raw = max30100_read_raw,
425424 };
426425
drivers/iio/health/max30102.c+0−1
@@ -381,7 +381,6 @@ static int max30102_read_raw(struct iio_dev *indio_dev, · 380 unmodified lines
381381 }
382382
383383 static const struct iio_info max30102_info = {
384− .driver_module = THIS_MODULE,
385384 .read_raw = max30102_read_raw,
386385 };
387386
drivers/iio/humidity/am2315.c+0−1
@@ -215,7 +215,6 @@ static int am2315_read_raw(struct iio_dev *indio_dev, · 214 unmodified lines
215215 }
216216
217217 static const struct iio_info am2315_info = {
218− .driver_module = THIS_MODULE,
219218 .read_raw = am2315_read_raw,
220219 };
221220
drivers/iio/humidity/dht11.c+0−1
@@ -284,7 +284,6 @@ err: · 283 unmodified lines
284284 }
285285
286286 static const struct iio_info dht11_iio_info = {
287− .driver_module = THIS_MODULE,
288287 .read_raw = dht11_read_raw,
289288 };
290289
drivers/iio/humidity/hdc100x.c+0−1
@@ -357,7 +357,6 @@ static const struct iio_info hdc100x_info = { · 356 unmodified lines
357357 .read_raw = hdc100x_read_raw,
358358 .write_raw = hdc100x_write_raw,
359359 .attrs = &hdc100x_attribute_group,
360− .driver_module = THIS_MODULE,
361360 };
362361
363362 static int hdc100x_probe(struct i2c_client *client,
drivers/iio/humidity/hid-sensor-humidity.c+0−1
@@ -125,7 +125,6 @@ static int humidity_write_raw(struct iio_dev *indio_dev, · 124 unmodified lines
125125 }
126126
127127 static const struct iio_info humidity_info = {
128− .driver_module = THIS_MODULE,
129128 .read_raw = &humidity_read_raw,
130129 .write_raw = &humidity_write_raw,
131130 };
drivers/iio/humidity/hts221_buffer.c+0−1
@@ -47,7 +47,6 @@ static int hts221_trig_set_state(struct iio_trigger *trig, bool state) · 46 unmodified lines
4747 }
4848
4949 static const struct iio_trigger_ops hts221_trigger_ops = {
50− .owner = THIS_MODULE,
5150 .set_trigger_state = hts221_trig_set_state,
5251 };
5352
drivers/iio/humidity/hts221_core.c+0−1
@@ -573,7 +573,6 @@ static const struct attribute_group hts221_attribute_group = { · 572 unmodified lines
573573 };
574574
575575 static const struct iio_info hts221_info = {
576− .driver_module = THIS_MODULE,
577576 .attrs = &hts221_attribute_group,
578577 .read_raw = hts221_read_raw,
579578 .write_raw = hts221_write_raw,
drivers/iio/humidity/htu21.c+0−1
@@ -175,7 +175,6 @@ static const struct iio_info htu21_info = { · 174 unmodified lines
175175 .read_raw = htu21_read_raw,
176176 .write_raw = htu21_write_raw,
177177 .attrs = &htu21_attribute_group,
178− .driver_module = THIS_MODULE,
179178 };
180179
181180 static int htu21_probe(struct i2c_client *client,
drivers/iio/humidity/si7005.c+0−1
@@ -124,7 +124,6 @@ static const struct iio_chan_spec si7005_channels[] = { · 123 unmodified lines
124124
125125 static const struct iio_info si7005_info = {
126126 .read_raw = si7005_read_raw,
127− .driver_module = THIS_MODULE,
128127 };
129128
130129 static int si7005_probe(struct i2c_client *client,
drivers/iio/humidity/si7020.c+0−1
@@ -108,7 +108,6 @@ static const struct iio_chan_spec si7020_channels[] = { · 107 unmodified lines
108108
109109 static const struct iio_info si7020_info = {
110110 .read_raw = si7020_read_raw,
111− .driver_module = THIS_MODULE,
112111 };
113112
114113 static int si7020_probe(struct i2c_client *client,
drivers/iio/imu/adis16400_core.c+0−1
@@ -833,7 +833,6 @@ static struct adis16400_chip_info adis16400_chips[] = { · 832 unmodified lines
833833 };
834834
835835 static const struct iio_info adis16400_info = {
836− .driver_module = THIS_MODULE,
837836 .read_raw = &adis16400_read_raw,
838837 .write_raw = &adis16400_write_raw,
839838 .update_scan_mode = adis16400_update_scan_mode,
drivers/iio/imu/adis16480.c+0−1
@@ -720,7 +720,6 @@ static const struct iio_info adis16480_info = { · 719 unmodified lines
720720 .read_raw = &adis16480_read_raw,
721721 .write_raw = &adis16480_write_raw,
722722 .update_scan_mode = adis_update_scan_mode,
723− .driver_module = THIS_MODULE,
724723 };
725724
726725 static int adis16480_stop_device(struct iio_dev *indio_dev)
drivers/iio/imu/adis_trigger.c+0−1
@@ -25,7 +25,6 @@ static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, · 24 unmodified lines
2525 }
2626
2727 static const struct iio_trigger_ops adis_trigger_ops = {
28− .owner = THIS_MODULE,
2928 .set_trigger_state = &adis_data_rdy_trigger_set_state,
3029 };
3130
drivers/iio/imu/bmi160/bmi160_core.c+0−1
@@ -482,7 +482,6 @@ static const struct attribute_group bmi160_attrs_group = { · 481 unmodified lines
482482 };
483483
484484 static const struct iio_info bmi160_info = {
485− .driver_module = THIS_MODULE,
486485 .read_raw = bmi160_read_raw,
487486 .write_raw = bmi160_write_raw,
488487 .attrs = &bmi160_attrs_group,
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c+8−5
@@ -542,7 +542,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev, · 541 unmodified lines
542542 break;
543543 default:
544544 result = -EINVAL;
545+ break;
545546 }
547+ break;
546548 default:
547549 result = -EINVAL;
548550 break;
@@ -570,10 +572,12 @@ error_write_raw_unlock: · 21 unmodified lines
570572 */
571573 static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
572574 {
573− const int hz[] = {188, 98, 42, 20, 10, 5};
574− const int d[] = {INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
575− INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
576− INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ};
575+ static const int hz[] = {188, 98, 42, 20, 10, 5};
576+ static const int d[] = {
577+ INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
578+ INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
579+ INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ
580+ };
577581 int i, h, result;
578582 u8 data;
579583
@@ -795,7 +799,6 @@ static const struct attribute_group inv_attribute_group = { · 215 unmodified lines
795799 };
796800
797801 static const struct iio_info mpu_info = {
798− .driver_module = THIS_MODULE,
799802 .read_raw = &inv_mpu6050_read_raw,
800803 .write_raw = &inv_mpu6050_write_raw,
801804 .write_raw_get_fmt = &inv_write_raw_get_fmt,
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c+0−1
@@ -114,7 +114,6 @@ static int inv_mpu_data_rdy_trigger_set_state(struct iio_trigger *trig, · 113 unmodified lines
114114 }
115115
116116 static const struct iio_trigger_ops inv_mpu_trigger_ops = {
117− .owner = THIS_MODULE,
118117 .set_trigger_state = &inv_mpu_data_rdy_trigger_set_state,
119118 };
120119
drivers/iio/imu/kmx61.c+0−3
@@ -1003,7 +1003,6 @@ static int kmx61_mag_validate_trigger(struct iio_dev *indio_dev, · 1002 unmodified lines
10031003 }
10041004
10051005 static const struct iio_info kmx61_acc_info = {
1006− .driver_module = THIS_MODULE,
10071006 .read_raw = kmx61_read_raw,
10081007 .write_raw = kmx61_write_raw,
10091008 .attrs = &kmx61_acc_attribute_group,
@@ -1015,7 +1014,6 @@ static const struct iio_info kmx61_acc_info = { · 5 unmodified lines
10151014 };
10161015
10171016 static const struct iio_info kmx61_mag_info = {
1018− .driver_module = THIS_MODULE,
10191017 .read_raw = kmx61_read_raw,
10201018 .write_raw = kmx61_write_raw,
10211019 .attrs = &kmx61_mag_attribute_group,
@@ -1087,7 +1085,6 @@ static int kmx61_trig_try_reenable(struct iio_trigger *trig) · 65 unmodified lines
10871085 static const struct iio_trigger_ops kmx61_trigger_ops = {
10881086 .set_trigger_state = kmx61_data_rdy_trigger_set_state,
10891087 .try_reenable = kmx61_trig_try_reenable,
1090− .owner = THIS_MODULE,
10911088 };
10921089
10931090 static irqreturn_t kmx61_event_handler(int irq, void *private)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h+28−4
@@ -29,8 +29,6 @@ enum st_lsm6dsx_hw_id { · 28 unmodified lines
2929
3030 #define ST_LSM6DSX_CHAN_SIZE 2
3131 #define ST_LSM6DSX_SAMPLE_SIZE 6
32−#define ST_LSM6DSX_SAMPLE_DEPTH (ST_LSM6DSX_SAMPLE_SIZE / \
33− ST_LSM6DSX_CHAN_SIZE)
3432
3533 #if defined(CONFIG_SPI_MASTER)
3634 #define ST_LSM6DSX_RX_MAX_LENGTH 256
@@ -52,10 +50,38 @@ struct st_lsm6dsx_reg { · 15 unmodified lines
5250 u8 mask;
5351 };
5452
53+/**
54+ * struct st_lsm6dsx_fifo_ops - ST IMU FIFO settings
55+ * @fifo_th: FIFO threshold register info (addr + mask).
56+ * @fifo_diff: FIFO diff status register info (addr + mask).
57+ * @th_wl: FIFO threshold word length.
58+ */
59+struct st_lsm6dsx_fifo_ops {
60+ struct {
61+ u8 addr;
62+ u16 mask;
63+ } fifo_th;
64+ struct {
65+ u8 addr;
66+ u16 mask;
67+ } fifo_diff;
68+ u8 th_wl;
69+};
70+
71+/**
72+ * struct st_lsm6dsx_settings - ST IMU sensor settings
73+ * @wai: Sensor WhoAmI default value.
74+ * @max_fifo_size: Sensor max fifo length in FIFO words.
75+ * @id: List of hw id supported by the driver configuration.
76+ * @decimator: List of decimator register info (addr + mask).
77+ * @fifo_ops: Sensor hw FIFO parameters.
78+ */
5579 struct st_lsm6dsx_settings {
5680 u8 wai;
5781 u16 max_fifo_size;
5882 enum st_lsm6dsx_hw_id id[ST_LSM6DSX_MAX_ID];
83+ struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID];
84+ struct st_lsm6dsx_fifo_ops fifo_ops;
5985 };
6086
6187 enum st_lsm6dsx_sensor_id {
@@ -79,7 +105,6 @@ enum st_lsm6dsx_fifo_mode { · 17 unmodified lines
79105 * @watermark: Sensor watermark level.
80106 * @sip: Number of samples in a given pattern.
81107 * @decimator: FIFO decimation factor.
82− * @decimator_mask: Sensor mask for decimation register.
83108 * @delta_ts: Delta time between two consecutive interrupts.
84109 * @ts: Latest timestamp from the interrupt handler.
85110 */
@@ -94,7 +119,6 @@ struct st_lsm6dsx_sensor { · 8 unmodified lines
94119 u16 watermark;
95120 u8 sip;
96121 u8 decimator;
97− u8 decimator_mask;
98122
99123 s64 delta_ts;
100124 s64 ts;
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c+36−36
@@ -35,10 +35,6 @@ · 34 unmodified lines
3535
3636 #include "st_lsm6dsx.h"
3737
38−#define ST_LSM6DSX_REG_FIFO_THL_ADDR 0x06
39−#define ST_LSM6DSX_REG_FIFO_THH_ADDR 0x07
40−#define ST_LSM6DSX_FIFO_TH_MASK GENMASK(11, 0)
41−#define ST_LSM6DSX_REG_FIFO_DEC_GXL_ADDR 0x08
4238 #define ST_LSM6DSX_REG_HLACTIVE_ADDR 0x12
4339 #define ST_LSM6DSX_REG_HLACTIVE_MASK BIT(5)
4440 #define ST_LSM6DSX_REG_PP_OD_ADDR 0x12
@@ -46,8 +42,6 @@ · 1 unmodified line
4642 #define ST_LSM6DSX_REG_FIFO_MODE_ADDR 0x0a
4743 #define ST_LSM6DSX_FIFO_MODE_MASK GENMASK(2, 0)
4844 #define ST_LSM6DSX_FIFO_ODR_MASK GENMASK(6, 3)
49−#define ST_LSM6DSX_REG_FIFO_DIFFL_ADDR 0x3a
50−#define ST_LSM6DSX_FIFO_DIFF_MASK GENMASK(11, 0)
5145 #define ST_LSM6DSX_FIFO_EMPTY_MASK BIT(12)
5246 #define ST_LSM6DSX_REG_FIFO_OUTL_ADDR 0x3e
5347
@@ -110,8 +104,9 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw) · 56 unmodified lines
110104 st_lsm6dsx_get_max_min_odr(hw, &max_odr, &min_odr);
111105
112106 for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
113− sensor = iio_priv(hw->iio_devs[i]);
107+ const struct st_lsm6dsx_reg *dec_reg;
114108
109+ sensor = iio_priv(hw->iio_devs[i]);
115110 /* update fifo decimators and sample in pattern */
116111 if (hw->enable_mask & BIT(sensor->id)) {
117112 sensor->sip = sensor->odr / min_odr;
@@ -123,12 +118,13 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw) · 5 unmodified lines
123118 data = 0;
124119 }
125120
126− err = st_lsm6dsx_write_with_mask(hw,
127− ST_LSM6DSX_REG_FIFO_DEC_GXL_ADDR,
128− sensor->decimator_mask, data);
129− if (err < 0)
130− return err;
131−
121+ dec_reg = &hw->settings->decimator[sensor->id];
122+ if (dec_reg->addr) {
123+ err = st_lsm6dsx_write_with_mask(hw, dec_reg->addr,
124+ dec_reg->mask, data);
125+ if (err < 0)
126+ return err;
127+ }
132128 sip += sensor->sip;
133129 }
134130 hw->sip = sip;
@@ -139,23 +135,10 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw) · 4 unmodified lines
139135 int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
140136 enum st_lsm6dsx_fifo_mode fifo_mode)
141137 {
142− u8 data;
143138 int err;
144139
145− switch (fifo_mode) {
146− case ST_LSM6DSX_FIFO_BYPASS:
147− data = fifo_mode;
148− break;
149− case ST_LSM6DSX_FIFO_CONT:
150− data = (ST_LSM6DSX_MAX_FIFO_ODR_VAL <<
151− __ffs(ST_LSM6DSX_FIFO_ODR_MASK)) | fifo_mode;
152− break;
153− default:
154− return -EINVAL;
155− }
156−
157− err = hw->tf->write(hw->dev, ST_LSM6DSX_REG_FIFO_MODE_ADDR,
158− sizeof(data), &data);
140+ err = st_lsm6dsx_write_with_mask(hw, ST_LSM6DSX_REG_FIFO_MODE_ADDR,
141+ ST_LSM6DSX_FIFO_MODE_MASK, fifo_mode);
159142 if (err < 0)
160143 return err;
161144
@@ -164,9 +147,20 @@ int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw, · 2 unmodified lines
164147 return 0;
165148 }
166149
150+static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
151+ bool enable)
152+{
153+ struct st_lsm6dsx_hw *hw = sensor->hw;
154+ u8 data;
155+
156+ data = hw->enable_mask ? ST_LSM6DSX_MAX_FIFO_ODR_VAL : 0;
157+ return st_lsm6dsx_write_with_mask(hw, ST_LSM6DSX_REG_FIFO_MODE_ADDR,
158+ ST_LSM6DSX_FIFO_ODR_MASK, data);
159+}
160+
167161 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark)
168162 {
169− u16 fifo_watermark = ~0, cur_watermark, sip = 0;
163+ u16 fifo_watermark = ~0, cur_watermark, sip = 0, fifo_th_mask;
170164 struct st_lsm6dsx_hw *hw = sensor->hw;
171165 struct st_lsm6dsx_sensor *cur_sensor;
172166 __le16 wdata;
@@ -191,20 +185,21 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark) · 18 unmodified lines
191185
192186 fifo_watermark = max_t(u16, fifo_watermark, sip);
193187 fifo_watermark = (fifo_watermark / sip) * sip;
194− fifo_watermark = fifo_watermark * ST_LSM6DSX_SAMPLE_DEPTH;
188+ fifo_watermark = fifo_watermark * hw->settings->fifo_ops.th_wl;
195189
196190 mutex_lock(&hw->lock);
197191
198− err = hw->tf->read(hw->dev, ST_LSM6DSX_REG_FIFO_THH_ADDR,
192+ err = hw->tf->read(hw->dev, hw->settings->fifo_ops.fifo_th.addr + 1,
199193 sizeof(data), &data);
200194 if (err < 0)
201195 goto out;
202196
203− fifo_watermark = ((data << 8) & ~ST_LSM6DSX_FIFO_TH_MASK) |
204− (fifo_watermark & ST_LSM6DSX_FIFO_TH_MASK);
197+ fifo_th_mask = hw->settings->fifo_ops.fifo_th.mask;
198+ fifo_watermark = ((data << 8) & ~fifo_th_mask) |
199+ (fifo_watermark & fifo_th_mask);
205200
206201 wdata = cpu_to_le16(fifo_watermark);
207− err = hw->tf->write(hw->dev, ST_LSM6DSX_REG_FIFO_THL_ADDR,
202+ err = hw->tf->write(hw->dev, hw->settings->fifo_ops.fifo_th.addr,
208203 sizeof(wdata), (u8 *)&wdata);
209204 out:
210205 mutex_unlock(&hw->lock);
@@ -223,6 +218,7 @@ out: · 12 unmodified lines
223218 static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
224219 {
225220 u16 fifo_len, pattern_len = hw->sip * ST_LSM6DSX_SAMPLE_SIZE;
221+ u16 fifo_diff_mask = hw->settings->fifo_ops.fifo_diff.mask;
226222 int err, acc_sip, gyro_sip, read_len, samples, offset;
227223 struct st_lsm6dsx_sensor *acc_sensor, *gyro_sensor;
228224 s64 acc_ts, acc_delta_ts, gyro_ts, gyro_delta_ts;
@@ -230,7 +226,7 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · 1 unmodified line
230226 u8 buff[pattern_len];
231227 __le16 fifo_status;
232228
233− err = hw->tf->read(hw->dev, ST_LSM6DSX_REG_FIFO_DIFFL_ADDR,
229+ err = hw->tf->read(hw->dev, hw->settings->fifo_ops.fifo_diff.addr,
234230 sizeof(fifo_status), (u8 *)&fifo_status);
235231 if (err < 0)
236232 return err;
@@ -238,7 +234,7 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · 1 unmodified line
238234 if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK))
239235 return 0;
240236
241− fifo_len = (le16_to_cpu(fifo_status) & ST_LSM6DSX_FIFO_DIFF_MASK) *
237+ fifo_len = (le16_to_cpu(fifo_status) & fifo_diff_mask) *
242238 ST_LSM6DSX_CHAN_SIZE;
243239 samples = fifo_len / ST_LSM6DSX_SAMPLE_SIZE;
244240 fifo_len = (fifo_len / pattern_len) * pattern_len;
@@ -345,6 +341,10 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, bool enable) · 100 unmodified lines
345341 return err;
346342 }
347343
344+ err = st_lsm6dsx_set_fifo_odr(sensor, enable);
345+ if (err < 0)
346+ return err;
347+
348348 err = st_lsm6dsx_update_decimators(hw);
349349 if (err < 0)
350350 return err;
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c+70−28
@@ -42,8 +42,6 @@ · 41 unmodified lines
4242
4343 #include "st_lsm6dsx.h"
4444
45−#define ST_LSM6DSX_REG_ACC_DEC_MASK GENMASK(2, 0)
46−#define ST_LSM6DSX_REG_GYRO_DEC_MASK GENMASK(5, 3)
4745 #define ST_LSM6DSX_REG_INT1_ADDR 0x0d
4846 #define ST_LSM6DSX_REG_INT2_ADDR 0x0e
4947 #define ST_LSM6DSX_REG_FIFO_FTH_IRQ_MASK BIT(3)
@@ -54,10 +52,6 @@ · 4 unmodified lines
5452 #define ST_LSM6DSX_REG_BDU_MASK BIT(6)
5553 #define ST_LSM6DSX_REG_INT2_ON_INT1_ADDR 0x13
5654 #define ST_LSM6DSX_REG_INT2_ON_INT1_MASK BIT(5)
57−#define ST_LSM6DSX_REG_ROUNDING_ADDR 0x16
58−#define ST_LSM6DSX_REG_ROUNDING_MASK BIT(2)
59−#define ST_LSM6DSX_REG_LIR_ADDR 0x58
60−#define ST_LSM6DSX_REG_LIR_MASK BIT(0)
6155
6256 #define ST_LSM6DSX_REG_ACC_ODR_ADDR 0x10
6357 #define ST_LSM6DSX_REG_ACC_ODR_MASK GENMASK(7, 4)
@@ -160,25 +154,88 @@ static const struct st_lsm6dsx_fs_table_entry st_lsm6dsx_fs_table[] = { · 96 unmodified lines
160154 static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
161155 {
162156 .wai = 0x69,
163− .max_fifo_size = 8192,
157+ .max_fifo_size = 1365,
164158 .id = {
165159 [0] = ST_LSM6DS3_ID,
166160 },
161+ .decimator = {
162+ [ST_LSM6DSX_ID_ACC] = {
163+ .addr = 0x08,
164+ .mask = GENMASK(2, 0),
165+ },
166+ [ST_LSM6DSX_ID_GYRO] = {
167+ .addr = 0x08,
168+ .mask = GENMASK(5, 3),
169+ },
170+ },
171+ .fifo_ops = {
172+ .fifo_th = {
173+ .addr = 0x06,
174+ .mask = GENMASK(11, 0),
175+ },
176+ .fifo_diff = {
177+ .addr = 0x3a,
178+ .mask = GENMASK(11, 0),
179+ },
180+ .th_wl = 3, /* 1LSB = 2B */
181+ },
167182 },
168183 {
169184 .wai = 0x69,
170− .max_fifo_size = 4096,
185+ .max_fifo_size = 682,
171186 .id = {
172187 [0] = ST_LSM6DS3H_ID,
173188 },
189+ .decimator = {
190+ [ST_LSM6DSX_ID_ACC] = {
191+ .addr = 0x08,
192+ .mask = GENMASK(2, 0),
193+ },
194+ [ST_LSM6DSX_ID_GYRO] = {
195+ .addr = 0x08,
196+ .mask = GENMASK(5, 3),
197+ },
198+ },
199+ .fifo_ops = {
200+ .fifo_th = {
201+ .addr = 0x06,
202+ .mask = GENMASK(11, 0),
203+ },
204+ .fifo_diff = {
205+ .addr = 0x3a,
206+ .mask = GENMASK(11, 0),
207+ },
208+ .th_wl = 3, /* 1LSB = 2B */
209+ },
174210 },
175211 {
176212 .wai = 0x6a,
177− .max_fifo_size = 4096,
213+ .max_fifo_size = 682,
178214 .id = {
179215 [0] = ST_LSM6DSL_ID,
180216 [1] = ST_LSM6DSM_ID,
181217 },
218+ .decimator = {
219+ [ST_LSM6DSX_ID_ACC] = {
220+ .addr = 0x08,
221+ .mask = GENMASK(2, 0),
222+ },
223+ [ST_LSM6DSX_ID_GYRO] = {
224+ .addr = 0x08,
225+ .mask = GENMASK(5, 3),
226+ },
227+ },
228+ .fifo_ops = {
229+ .fifo_th = {
230+ .addr = 0x06,
231+ .mask = GENMASK(11, 0),
232+ },
233+ .fifo_diff = {
234+ .addr = 0x3a,
235+ .mask = GENMASK(11, 0),
236+ },
237+ .th_wl = 3, /* 1LSB = 2B */
238+ },
182239 },
183240 };
184241
@@ -322,7 +379,6 @@ static int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u16 odr, · 137 unmodified lines
322379 return -EINVAL;
323380
324381 *val = st_lsm6dsx_odr_table[sensor->id].odr_avl[i].val;
325− sensor->odr = odr;
326382
327383 return 0;
328384 }
@@ -449,6 +505,8 @@ static int st_lsm6dsx_write_raw(struct iio_dev *iio_dev, · 120 unmodified lines
449505 u8 data;
450506
451507 err = st_lsm6dsx_check_odr(sensor, val, &data);
508+ if (!err)
509+ sensor->odr = val;
452510 break;
453511 }
454512 default:
@@ -465,10 +523,9 @@ static int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val) · 10 unmodified lines
465523 {
466524 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
467525 struct st_lsm6dsx_hw *hw = sensor->hw;
468− int err, max_fifo_len;
526+ int err;
469527
470− max_fifo_len = hw->settings->max_fifo_size / ST_LSM6DSX_SAMPLE_SIZE;
471− if (val < 1 || val > max_fifo_len)
528+ if (val < 1 || val > hw->settings->max_fifo_size)
472529 return -EINVAL;
473530
474531 err = st_lsm6dsx_update_watermark(sensor, val);
@@ -530,7 +587,6 @@ static const struct attribute_group st_lsm6dsx_acc_attribute_group = { · 55 unmodified lines
530587 };
531588
532589 static const struct iio_info st_lsm6dsx_acc_info = {
533− .driver_module = THIS_MODULE,
534590 .attrs = &st_lsm6dsx_acc_attribute_group,
535591 .read_raw = st_lsm6dsx_read_raw,
536592 .write_raw = st_lsm6dsx_write_raw,
@@ -548,7 +604,6 @@ static const struct attribute_group st_lsm6dsx_gyro_attribute_group = { · 11 unmodified lines
548604 };
549605
550606 static const struct iio_info st_lsm6dsx_gyro_info = {
551− .driver_module = THIS_MODULE,
552607 .attrs = &st_lsm6dsx_gyro_attribute_group,
553608 .read_raw = st_lsm6dsx_read_raw,
554609 .write_raw = st_lsm6dsx_write_raw,
@@ -608,23 +663,12 @@ static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) · 53 unmodified lines
608663
609664 msleep(200);
610665
611− /* latch interrupts */
612− err = st_lsm6dsx_write_with_mask(hw, ST_LSM6DSX_REG_LIR_ADDR,
613− ST_LSM6DSX_REG_LIR_MASK, 1);
614− if (err < 0)
615− return err;
616−
617666 /* enable Block Data Update */
618667 err = st_lsm6dsx_write_with_mask(hw, ST_LSM6DSX_REG_BDU_ADDR,
619668 ST_LSM6DSX_REG_BDU_MASK, 1);
620669 if (err < 0)
621670 return err;
622671
623− err = st_lsm6dsx_write_with_mask(hw, ST_LSM6DSX_REG_ROUNDING_ADDR,
624− ST_LSM6DSX_REG_ROUNDING_MASK, 1);
625− if (err < 0)
626− return err;
627−
628672 /* enable FIFO watermak interrupt */
629673 err = st_lsm6dsx_get_drdy_reg(hw, &drdy_int_reg);
630674 if (err < 0)
@@ -662,7 +706,6 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw, · 31 unmodified lines
662706 iio_dev->num_channels = ARRAY_SIZE(st_lsm6dsx_acc_channels);
663707 iio_dev->info = &st_lsm6dsx_acc_info;
664708
665− sensor->decimator_mask = ST_LSM6DSX_REG_ACC_DEC_MASK;
666709 scnprintf(sensor->name, sizeof(sensor->name), "%s_accel",
667710 name);
668711 break;
@@ -671,7 +714,6 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw, · 2 unmodified lines
671714 iio_dev->num_channels = ARRAY_SIZE(st_lsm6dsx_gyro_channels);
672715 iio_dev->info = &st_lsm6dsx_gyro_info;
673716
674− sensor->decimator_mask = ST_LSM6DSX_REG_GYRO_DEC_MASK;
675717 scnprintf(sensor->name, sizeof(sensor->name), "%s_gyro",
676718 name);
677719 break;
drivers/iio/industrialio-core.c+9−26
@@ -1662,14 +1662,11 @@ static int iio_check_unique_scan_index(struct iio_dev *indio_dev) · 1661 unmodified lines
16621662
16631663 static const struct iio_buffer_setup_ops noop_ring_setup_ops;
16641664
1665−/**
1666− * iio_device_register() - register a device with the IIO subsystem
1667− * @indio_dev: Device structure filled by the device driver
1668− **/
1669−int iio_device_register(struct iio_dev *indio_dev)
1665+int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
16701666 {
16711667 int ret;
16721668
1669+ indio_dev->driver_module = this_mod;
16731670 /* If the calling driver did not initialize of_node, do it here */
16741671 if (!indio_dev->dev.of_node && indio_dev->dev.parent)
16751672 indio_dev->dev.of_node = indio_dev->dev.parent->of_node;
@@ -1715,7 +1712,8 @@ int iio_device_register(struct iio_dev *indio_dev) · 39 unmodified lines
17151712 indio_dev->setup_ops = &noop_ring_setup_ops;
17161713
17171714 cdev_init(&indio_dev->chrdev, &iio_buffer_fileops);
1718− indio_dev->chrdev.owner = indio_dev->info->driver_module;
1715+
1716+ indio_dev->chrdev.owner = this_mod;
17191717
17201718 ret = cdev_device_add(&indio_dev->chrdev, &indio_dev->dev);
17211719 if (ret < 0)
@@ -1733,7 +1731,7 @@ error_unreg_debugfs: · 11 unmodified lines
17331731 iio_device_unregister_debugfs(indio_dev);
17341732 return ret;
17351733 }
1736−EXPORT_SYMBOL(iio_device_register);
1734+EXPORT_SYMBOL(__iio_device_register);
17371735
17381736 /**
17391737 * iio_device_unregister() - unregister a device from the IIO subsystem
@@ -1765,23 +1763,8 @@ static void devm_iio_device_unreg(struct device *dev, void *res) · 25 unmodified lines
17651763 iio_device_unregister(*(struct iio_dev **)res);
17661764 }
17671765
1768−/**
1769− * devm_iio_device_register - Resource-managed iio_device_register()
1770− * @dev: Device to allocate iio_dev for
1771− * @indio_dev: Device structure filled by the device driver
1772− *
1773− * Managed iio_device_register. The IIO device registered with this
1774− * function is automatically unregistered on driver detach. This function
1775− * calls iio_device_register() internally. Refer to that function for more
1776− * information.
1777− *
1778− * If an iio_dev registered with this function needs to be unregistered
1779− * separately, devm_iio_device_unregister() must be used.
1780− *
1781− * RETURNS:
1782− * 0 on success, negative error number on failure.
1783− */
1784−int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev)
1766+int __devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev,
1767+ struct module *this_mod)
17851768 {
17861769 struct iio_dev **ptr;
17871770 int ret;
@@ -1791,7 +1774,7 @@ int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev) · 3 unmodified lines
17911774 return -ENOMEM;
17921775
17931776 *ptr = indio_dev;
1794− ret = iio_device_register(indio_dev);
1777+ ret = __iio_device_register(indio_dev, this_mod);
17951778 if (!ret)
17961779 devres_add(dev, ptr);
17971780 else
@@ -1799,7 +1782,7 @@ int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev) · 1 unmodified line
17991782
18001783 return ret;
18011784 }
1802−EXPORT_SYMBOL_GPL(devm_iio_device_register);
1785+EXPORT_SYMBOL_GPL(__devm_iio_device_register);
18031786
18041787 /**
18051788 * devm_iio_device_unregister - Resource-managed iio_device_unregister()
drivers/iio/industrialio-trigger.c+19−16
@@ -66,13 +66,12 @@ ATTRIBUTE_GROUPS(iio_trig_dev); · 65 unmodified lines
6666
6767 static struct iio_trigger *__iio_trigger_find_by_name(const char *name);
6868
69−int iio_trigger_register(struct iio_trigger *trig_info)
69+int __iio_trigger_register(struct iio_trigger *trig_info,
70+ struct module *this_mod)
7071 {
7172 int ret;
7273
73− /* trig_info->ops is required for the module member */
74− if (!trig_info->ops)
75− return -EINVAL;
74+ trig_info->owner = this_mod;
7675
7776 trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
7877 if (trig_info->id < 0)
@@ -105,7 +104,7 @@ error_unregister_id: · 26 unmodified lines
105104 ida_simple_remove(&iio_trigger_ida, trig_info->id);
106105 return ret;
107106 }
108−EXPORT_SYMBOL(iio_trigger_register);
107+EXPORT_SYMBOL(__iio_trigger_register);
109108
110109 void iio_trigger_unregister(struct iio_trigger *trig_info)
111110 {
@@ -206,7 +205,8 @@ EXPORT_SYMBOL(iio_trigger_poll_chained); · 94 unmodified lines
206205
207206 void iio_trigger_notify_done(struct iio_trigger *trig)
208207 {
209− if (atomic_dec_and_test(&trig->use_count) && trig->ops->try_reenable)
208+ if (atomic_dec_and_test(&trig->use_count) && trig->ops &&
209+ trig->ops->try_reenable)
210210 if (trig->ops->try_reenable(trig))
211211 /* Missed an interrupt so launch new poll now */
212212 iio_trigger_poll(trig);
@@ -250,7 +250,7 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, · 37 unmodified lines
250250 = bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
251251
252252 /* Prevent the module from being removed whilst attached to a trigger */
253− __module_get(pf->indio_dev->info->driver_module);
253+ __module_get(pf->indio_dev->driver_module);
254254
255255 /* Get irq number */
256256 pf->irq = iio_trigger_get_irq(trig);
@@ -265,7 +265,7 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, · 8 unmodified lines
265265 goto out_put_irq;
266266
267267 /* Enable trigger in driver */
268− if (trig->ops->set_trigger_state && notinuse) {
268+ if (trig->ops && trig->ops->set_trigger_state && notinuse) {
269269 ret = trig->ops->set_trigger_state(trig, true);
270270 if (ret < 0)
271271 goto out_free_irq;
@@ -286,7 +286,7 @@ out_free_irq: · 14 unmodified lines
286286 out_put_irq:
287287 iio_trigger_put_irq(trig, pf->irq);
288288 out_put_module:
289− module_put(pf->indio_dev->info->driver_module);
289+ module_put(pf->indio_dev->driver_module);
290290 return ret;
291291 }
292292
@@ -298,7 +298,7 @@ static int iio_trigger_detach_poll_func(struct iio_trigger *trig, · 5 unmodified lines
298298 = (bitmap_weight(trig->pool,
299299 CONFIG_IIO_CONSUMERS_PER_TRIGGER)
300300 == 1);
301− if (trig->ops->set_trigger_state && no_other_users) {
301+ if (trig->ops && trig->ops->set_trigger_state && no_other_users) {
302302 ret = trig->ops->set_trigger_state(trig, false);
303303 if (ret)
304304 return ret;
@@ -307,7 +307,7 @@ static int iio_trigger_detach_poll_func(struct iio_trigger *trig, · 2 unmodified lines
307307 trig->attached_own_device = false;
308308 iio_trigger_put_irq(trig, pf->irq);
309309 free_irq(pf->irq, pf);
310− module_put(pf->indio_dev->info->driver_module);
310+ module_put(pf->indio_dev->driver_module);
311311
312312 return ret;
313313 }
@@ -428,7 +428,7 @@ static ssize_t iio_trigger_write_current(struct device *dev, · 114 unmodified lines
428428 goto out_trigger_put;
429429 }
430430
431− if (trig && trig->ops->validate_device) {
431+ if (trig && trig->ops && trig->ops->validate_device) {
432432 ret = trig->ops->validate_device(trig, indio_dev);
433433 if (ret)
434434 goto out_trigger_put;
@@ -663,9 +663,10 @@ static void devm_iio_trigger_unreg(struct device *dev, void *res) · 228 unmodified lines
663663 }
664664
665665 /**
666− * devm_iio_trigger_register - Resource-managed iio_trigger_register()
666+ * __devm_iio_trigger_register - Resource-managed iio_trigger_register()
667667 * @dev: device this trigger was allocated for
668668 * @trig_info: trigger to register
669+ * @this_mod: module registering the trigger
669670 *
670671 * Managed iio_trigger_register(). The IIO trigger registered with this
671672 * function is automatically unregistered on driver detach. This function
@@ -678,7 +679,9 @@ static void devm_iio_trigger_unreg(struct device *dev, void *res) · 6 unmodified lines
678679 * RETURNS:
679680 * 0 on success, negative error number on failure.
680681 */
681−int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info)
682+int __devm_iio_trigger_register(struct device *dev,
683+ struct iio_trigger *trig_info,
684+ struct module *this_mod)
682685 {
683686 struct iio_trigger **ptr;
684687 int ret;
@@ -688,7 +691,7 @@ int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) · 3 unmodified lines
688691 return -ENOMEM;
689692
690693 *ptr = trig_info;
691− ret = iio_trigger_register(trig_info);
694+ ret = __iio_trigger_register(trig_info, this_mod);
692695 if (!ret)
693696 devres_add(dev, ptr);
694697 else
@@ -696,7 +699,7 @@ int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) · 1 unmodified line
696699
697700 return ret;
698701 }
699−EXPORT_SYMBOL_GPL(devm_iio_trigger_register);
702+EXPORT_SYMBOL_GPL(__devm_iio_trigger_register);
700703
701704 /**
702705 * devm_iio_trigger_unregister - Resource-managed iio_trigger_unregister()
drivers/iio/light/acpi-als.c+0−1
@@ -171,7 +171,6 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev, · 170 unmodified lines
171171 }
172172
173173 static const struct iio_info acpi_als_info = {
174− .driver_module = THIS_MODULE,
175174 .read_raw = acpi_als_read_raw,
176175 };
177176
drivers/iio/light/adjd_s311.c+0−1
@@ -245,7 +245,6 @@ static const struct iio_info adjd_s311_info = { · 244 unmodified lines
245245 .read_raw = adjd_s311_read_raw,
246246 .write_raw = adjd_s311_write_raw,
247247 .update_scan_mode = adjd_s311_update_scan_mode,
248− .driver_module = THIS_MODULE,
249248 };
250249
251250 static int adjd_s311_probe(struct i2c_client *client,
drivers/iio/light/al3320a.c+0−1
@@ -168,7 +168,6 @@ static int al3320a_write_raw(struct iio_dev *indio_dev, · 167 unmodified lines
168168 }
169169
170170 static const struct iio_info al3320a_info = {
171− .driver_module = THIS_MODULE,
172171 .read_raw = al3320a_read_raw,
173172 .write_raw = al3320a_write_raw,
174173 .attrs = &al3320a_attribute_group,
drivers/iio/light/apds9300.c+0−2
@@ -337,12 +337,10 @@ static int apds9300_write_interrupt_config(struct iio_dev *indio_dev, · 336 unmodified lines
337337 }
338338
339339 static const struct iio_info apds9300_info_no_irq = {
340− .driver_module = THIS_MODULE,
341340 .read_raw = apds9300_read_raw,
342341 };
343342
344343 static const struct iio_info apds9300_info = {
345− .driver_module = THIS_MODULE,
346344 .read_raw = apds9300_read_raw,
347345 .read_event_value = apds9300_read_thresh,
348346 .write_event_value = apds9300_write_thresh,
drivers/iio/light/apds9960.c+0−1
@@ -744,7 +744,6 @@ static int apds9960_write_event_config(struct iio_dev *indio_dev, · 743 unmodified lines
744744 }
745745
746746 static const struct iio_info apds9960_info = {
747− .driver_module = THIS_MODULE,
748747 .attrs = &apds9960_attribute_group,
749748 .read_raw = apds9960_read_raw,
750749 .write_raw = apds9960_write_raw,
drivers/iio/light/bh1750.c+0−1
@@ -217,7 +217,6 @@ static const struct attribute_group bh1750_attribute_group = { · 216 unmodified lines
217217 };
218218
219219 static const struct iio_info bh1750_info = {
220− .driver_module = THIS_MODULE,
221220 .attrs = &bh1750_attribute_group,
222221 .read_raw = bh1750_read_raw,
223222 .write_raw = bh1750_write_raw,
drivers/iio/light/bh1780.c+0−1
@@ -128,7 +128,6 @@ static int bh1780_read_raw(struct iio_dev *indio_dev, · 127 unmodified lines
128128 }
129129
130130 static const struct iio_info bh1780_info = {
131− .driver_module = THIS_MODULE,
132131 .read_raw = bh1780_read_raw,
133132 .debugfs_reg_access = bh1780_debugfs_reg_access,
134133 };
drivers/iio/light/cm32181.c+0−1
@@ -292,7 +292,6 @@ static const struct attribute_group cm32181_attribute_group = { · 291 unmodified lines
292292 };
293293
294294 static const struct iio_info cm32181_info = {
295− .driver_module = THIS_MODULE,
296295 .read_raw = &cm32181_read_raw,
297296 .write_raw = &cm32181_write_raw,
298297 .attrs = &cm32181_attribute_group,
drivers/iio/light/cm3232.c+0−1
@@ -322,7 +322,6 @@ static const struct attribute_group cm3232_attribute_group = { · 321 unmodified lines
322322 };
323323
324324 static const struct iio_info cm3232_info = {
325− .driver_module = THIS_MODULE,
326325 .read_raw = &cm3232_read_raw,
327326 .write_raw = &cm3232_write_raw,
328327 .attrs = &cm3232_attribute_group,
drivers/iio/light/cm3323.c+0−1
@@ -211,7 +211,6 @@ static int cm3323_write_raw(struct iio_dev *indio_dev, · 210 unmodified lines
211211 }
212212
213213 static const struct iio_info cm3323_info = {
214− .driver_module = THIS_MODULE,
215214 .read_raw = cm3323_read_raw,
216215 .write_raw = cm3323_write_raw,
217216 .attrs = &cm3323_attribute_group,
drivers/iio/light/cm3605.c+0−1
@@ -126,7 +126,6 @@ static int cm3605_read_raw(struct iio_dev *indio_dev, · 125 unmodified lines
126126 }
127127
128128 static const struct iio_info cm3605_info = {
129− .driver_module = THIS_MODULE,
130129 .read_raw = cm3605_read_raw,
131130 };
132131
drivers/iio/light/cm36651.c+0−1
@@ -612,7 +612,6 @@ static const struct attribute_group cm36651_attribute_group = { · 611 unmodified lines
612612 };
613613
614614 static const struct iio_info cm36651_info = {
615− .driver_module = THIS_MODULE,
616615 .read_raw = &cm36651_read_raw,
617616 .write_raw = &cm36651_write_raw,
618617 .read_event_value = &cm36651_read_prox_thresh,
drivers/iio/light/cros_ec_light_prox.c+0−1
@@ -175,7 +175,6 @@ static int cros_ec_light_prox_write(struct iio_dev *indio_dev, · 174 unmodified lines
175175 static const struct iio_info cros_ec_light_prox_info = {
176176 .read_raw = &cros_ec_light_prox_read,
177177 .write_raw = &cros_ec_light_prox_write,
178− .driver_module = THIS_MODULE,
179178 };
180179
181180 static int cros_ec_light_prox_probe(struct platform_device *pdev)
drivers/iio/light/gp2ap020a00f.c+0−2
@@ -1384,7 +1384,6 @@ static const struct iio_info gp2ap020a00f_info = { · 1383 unmodified lines
13841384 .read_event_config = &gp2ap020a00f_read_event_config,
13851385 .write_event_value = &gp2ap020a00f_write_event_val,
13861386 .write_event_config = &gp2ap020a00f_write_event_config,
1387− .driver_module = THIS_MODULE,
13881387 };
13891388
13901389 static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
@@ -1481,7 +1480,6 @@ static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = { · 90 unmodified lines
14811480 };
14821481
14831482 static const struct iio_trigger_ops gp2ap020a00f_trigger_ops = {
1484− .owner = THIS_MODULE,
14851483 };
14861484
14871485 static int gp2ap020a00f_probe(struct i2c_client *client,
drivers/iio/light/hid-sensor-als.c+0−1
@@ -177,7 +177,6 @@ static int als_write_raw(struct iio_dev *indio_dev, · 176 unmodified lines
177177 }
178178
179179 static const struct iio_info als_info = {
180− .driver_module = THIS_MODULE,
181180 .read_raw = &als_read_raw,
182181 .write_raw = &als_write_raw,
183182 };
drivers/iio/light/hid-sensor-prox.c+0−1
@@ -156,7 +156,6 @@ static int prox_write_raw(struct iio_dev *indio_dev, · 155 unmodified lines
156156 }
157157
158158 static const struct iio_info prox_info = {
159− .driver_module = THIS_MODULE,
160159 .read_raw = &prox_read_raw,
161160 .write_raw = &prox_write_raw,
162161 };
drivers/iio/light/isl29018.c+0−2
@@ -624,14 +624,12 @@ static int isl29018_chip_init(struct isl29018_chip *chip) · 623 unmodified lines
624624
625625 static const struct iio_info isl29018_info = {
626626 .attrs = &isl29018_group,
627− .driver_module = THIS_MODULE,
628627 .read_raw = isl29018_read_raw,
629628 .write_raw = isl29018_write_raw,
630629 };
631630
632631 static const struct iio_info isl29023_info = {
633632 .attrs = &isl29023_group,
634− .driver_module = THIS_MODULE,
635633 .read_raw = isl29018_read_raw,
636634 .write_raw = isl29018_write_raw,
637635 };
drivers/iio/light/isl29028.c+0−1
@@ -536,7 +536,6 @@ static const struct iio_chan_spec isl29028_channels[] = { · 535 unmodified lines
536536
537537 static const struct iio_info isl29028_info = {
538538 .attrs = &isl29108_group,
539− .driver_module = THIS_MODULE,
540539 .read_raw = isl29028_read_raw,
541540 .write_raw = isl29028_write_raw,
542541 };
drivers/iio/light/isl29125.c+0−1
@@ -214,7 +214,6 @@ static const struct iio_info isl29125_info = { · 213 unmodified lines
214214 .read_raw = isl29125_read_raw,
215215 .write_raw = isl29125_write_raw,
216216 .attrs = &isl29125_attribute_group,
217− .driver_module = THIS_MODULE,
218217 };
219218
220219 static int isl29125_buffer_preenable(struct iio_dev *indio_dev)
drivers/iio/light/jsa1212.c+0−1
@@ -271,7 +271,6 @@ static const struct iio_chan_spec jsa1212_channels[] = { · 270 unmodified lines
271271 };
272272
273273 static const struct iio_info jsa1212_info = {
274− .driver_module = THIS_MODULE,
275274 .read_raw = &jsa1212_read_raw,
276275 };
277276
drivers/iio/light/lm3533-als.c+0−1
@@ -827,7 +827,6 @@ static int lm3533_als_disable(struct lm3533_als *als) · 826 unmodified lines
827827 static const struct iio_info lm3533_als_info = {
828828 .attrs = &lm3533_als_attribute_group,
829829 .event_attrs = &lm3533_als_event_attribute_group,
830− .driver_module = THIS_MODULE,
831830 .read_raw = &lm3533_als_read_raw,
832831 };
833832
drivers/iio/light/ltr501.c+0−4
@@ -1158,7 +1158,6 @@ static const struct iio_info ltr501_info_no_irq = { · 1157 unmodified lines
11581158 .read_raw = ltr501_read_raw,
11591159 .write_raw = ltr501_write_raw,
11601160 .attrs = &ltr501_attribute_group,
1161− .driver_module = THIS_MODULE,
11621161 };
11631162
11641163 static const struct iio_info ltr501_info = {
@@ -1169,14 +1168,12 @@ static const struct iio_info ltr501_info = { · 4 unmodified lines
11691168 .write_event_value = &ltr501_write_event,
11701169 .read_event_config = &ltr501_read_event_config,
11711170 .write_event_config = &ltr501_write_event_config,
1172− .driver_module = THIS_MODULE,
11731171 };
11741172
11751173 static const struct iio_info ltr301_info_no_irq = {
11761174 .read_raw = ltr501_read_raw,
11771175 .write_raw = ltr501_write_raw,
11781176 .attrs = &ltr301_attribute_group,
1179− .driver_module = THIS_MODULE,
11801177 };
11811178
11821179 static const struct iio_info ltr301_info = {
@@ -1187,7 +1184,6 @@ static const struct iio_info ltr301_info = { · 4 unmodified lines
11871184 .write_event_value = &ltr501_write_event,
11881185 .read_event_config = &ltr501_read_event_config,
11891186 .write_event_config = &ltr501_write_event_config,
1190− .driver_module = THIS_MODULE,
11911187 };
11921188
11931189 static struct ltr501_chip_info ltr501_chip_info_tbl[] = {
drivers/iio/light/max44000.c+0−1
@@ -402,7 +402,6 @@ static const struct attribute_group max44000_attribute_group = { · 401 unmodified lines
402402 };
403403
404404 static const struct iio_info max44000_info = {
405− .driver_module = THIS_MODULE,
406405 .read_raw = max44000_read_raw,
407406 .write_raw = max44000_write_raw,
408407 .write_raw_get_fmt = max44000_write_raw_get_fmt,
drivers/iio/light/opt3001.c+0−1
@@ -585,7 +585,6 @@ err: · 584 unmodified lines
585585 }
586586
587587 static const struct iio_info opt3001_info = {
588− .driver_module = THIS_MODULE,
589588 .attrs = &opt3001_attribute_group,
590589 .read_raw = opt3001_read_raw,
591590 .write_raw = opt3001_write_raw,
drivers/iio/light/pa12203001.c+0−1
@@ -306,7 +306,6 @@ static int pa12203001_write_raw(struct iio_dev *indio_dev, · 305 unmodified lines
306306 }
307307
308308 static const struct iio_info pa12203001_info = {
309− .driver_module = THIS_MODULE,
310309 .read_raw = pa12203001_read_raw,
311310 .write_raw = pa12203001_write_raw,
312311 .attrs = &pa12203001_attr_group,
drivers/iio/light/rpr0521.c+0−2
@@ -538,7 +538,6 @@ static int rpr0521_pxs_drdy_set_state(struct iio_trigger *trigger, · 537 unmodified lines
538538
539539 static const struct iio_trigger_ops rpr0521_trigger_ops = {
540540 .set_trigger_state = rpr0521_pxs_drdy_set_state,
541− .owner = THIS_MODULE,
542541 };
543542
544543
@@ -830,7 +829,6 @@ static int rpr0521_write_raw(struct iio_dev *indio_dev, · 285 unmodified lines
830829 }
831830
832831 static const struct iio_info rpr0521_info = {
833− .driver_module = THIS_MODULE,
834832 .read_raw = rpr0521_read_raw,
835833 .write_raw = rpr0521_write_raw,
836834 .attrs = &rpr0521_attribute_group,
drivers/iio/light/si1145.c+0−3
@@ -989,14 +989,12 @@ static const struct attribute_group si114x_attribute_group = { · 988 unmodified lines
989989 static const struct iio_info si1132_info = {
990990 .read_raw = si1145_read_raw,
991991 .write_raw = si1145_write_raw,
992− .driver_module = THIS_MODULE,
993992 .attrs = &si1132_attribute_group,
994993 };
995994
996995 static const struct iio_info si114x_info = {
997996 .read_raw = si1145_read_raw,
998997 .write_raw = si1145_write_raw,
999− .driver_module = THIS_MODULE,
1000998 .attrs = &si114x_attribute_group,
1001999 };
10021000
@@ -1237,7 +1235,6 @@ disable: · 234 unmodified lines
12371235 }
12381236
12391237 static const struct iio_trigger_ops si1145_trigger_ops = {
1240− .owner = THIS_MODULE,
12411238 .set_trigger_state = si1145_trigger_set_state,
12421239 };
12431240
drivers/iio/light/stk3310.c+0−1
@@ -409,7 +409,6 @@ static int stk3310_write_raw(struct iio_dev *indio_dev, · 408 unmodified lines
409409 }
410410
411411 static const struct iio_info stk3310_info = {
412− .driver_module = THIS_MODULE,
413412 .read_raw = stk3310_read_raw,
414413 .write_raw = stk3310_write_raw,
415414 .attrs = &stk3310_attribute_group,
drivers/iio/light/tcs3414.c+0−1
@@ -241,7 +241,6 @@ static const struct iio_info tcs3414_info = { · 240 unmodified lines
241241 .read_raw = tcs3414_read_raw,
242242 .write_raw = tcs3414_write_raw,
243243 .attrs = &tcs3414_attribute_group,
244− .driver_module = THIS_MODULE,
245244 };
246245
247246 static int tcs3414_buffer_preenable(struct iio_dev *indio_dev)
drivers/iio/light/tcs3472.c+254−9
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 *
1414 * Datasheet: http://ams.com/eng/content/download/319364/1117183/file/TCS3472_Datasheet_EN_v2.pdf
1515 *
16− * TODO: interrupt support, thresholds, wait time
16+ * TODO: wait time
1717 */
1818
1919 #include <linux/module.h>
@@ -23,6 +23,7 @@ · 3 unmodified lines
2323
2424 #include <linux/iio/iio.h>
2525 #include <linux/iio/sysfs.h>
26+#include <linux/iio/events.h>
2627 #include <linux/iio/trigger_consumer.h>
2728 #include <linux/iio/buffer.h>
2829 #include <linux/iio/triggered_buffer.h>
@@ -31,12 +32,15 @@ · 2 unmodified lines
3132
3233 #define TCS3472_COMMAND BIT(7)
3334 #define TCS3472_AUTO_INCR BIT(5)
35+#define TCS3472_SPECIAL_FUNC (BIT(5) | BIT(6))
36+
37+#define TCS3472_INTR_CLEAR (TCS3472_COMMAND | TCS3472_SPECIAL_FUNC | 0x06)
3438
3539 #define TCS3472_ENABLE (TCS3472_COMMAND | 0x00)
3640 #define TCS3472_ATIME (TCS3472_COMMAND | 0x01)
3741 #define TCS3472_WTIME (TCS3472_COMMAND | 0x03)
38−#define TCS3472_AILT (TCS3472_COMMAND | 0x04)
39−#define TCS3472_AIHT (TCS3472_COMMAND | 0x06)
42+#define TCS3472_AILT (TCS3472_COMMAND | TCS3472_AUTO_INCR | 0x04)
43+#define TCS3472_AIHT (TCS3472_COMMAND | TCS3472_AUTO_INCR | 0x06)
4044 #define TCS3472_PERS (TCS3472_COMMAND | 0x0c)
4145 #define TCS3472_CONFIG (TCS3472_COMMAND | 0x0d)
4246 #define TCS3472_CONTROL (TCS3472_COMMAND | 0x0f)
@@ -47,19 +51,42 @@ · 4 unmodified lines
4751 #define TCS3472_GDATA (TCS3472_COMMAND | TCS3472_AUTO_INCR | 0x18)
4852 #define TCS3472_BDATA (TCS3472_COMMAND | TCS3472_AUTO_INCR | 0x1a)
4953
54+#define TCS3472_STATUS_AINT BIT(4)
5055 #define TCS3472_STATUS_AVALID BIT(0)
56+#define TCS3472_ENABLE_AIEN BIT(4)
5157 #define TCS3472_ENABLE_AEN BIT(1)
5258 #define TCS3472_ENABLE_PON BIT(0)
5359 #define TCS3472_CONTROL_AGAIN_MASK (BIT(0) | BIT(1))
5460
5561 struct tcs3472_data {
5662 struct i2c_client *client;
63+ struct mutex lock;
64+ u16 low_thresh;
65+ u16 high_thresh;
5766 u8 enable;
5867 u8 control;
5968 u8 atime;
69+ u8 apers;
6070 u16 buffer[8]; /* 4 16-bit channels + 64-bit timestamp */
6171 };
6272
73+static const struct iio_event_spec tcs3472_events[] = {
74+ {
75+ .type = IIO_EV_TYPE_THRESH,
76+ .dir = IIO_EV_DIR_RISING,
77+ .mask_separate = BIT(IIO_EV_INFO_VALUE),
78+ }, {
79+ .type = IIO_EV_TYPE_THRESH,
80+ .dir = IIO_EV_DIR_FALLING,
81+ .mask_separate = BIT(IIO_EV_INFO_VALUE),
82+ }, {
83+ .type = IIO_EV_TYPE_THRESH,
84+ .dir = IIO_EV_DIR_EITHER,
85+ .mask_separate = BIT(IIO_EV_INFO_ENABLE) |
86+ BIT(IIO_EV_INFO_PERIOD),
87+ },
88+};
89+
6390 #define TCS3472_CHANNEL(_color, _si, _addr) { \
6491 .type = IIO_INTENSITY, \
6592 .modified = 1, \
@@ -75,6 +102,8 @@ struct tcs3472_data { · 9 unmodified lines
75102 .storagebits = 16, \
76103 .endianness = IIO_CPU, \
77104 }, \
105+ .event_spec = _si ? NULL : tcs3472_events, \
106+ .num_event_specs = _si ? 0 : ARRAY_SIZE(tcs3472_events), \
78107 }
79108
80109 static const int tcs3472_agains[] = { 1, 4, 16, 60 };
@@ -182,6 +211,166 @@ static int tcs3472_write_raw(struct iio_dev *indio_dev, · 101 unmodified lines
182211 return -EINVAL;
183212 }
184213
214+/*
215+ * Translation from APERS field value to the number of consecutive out-of-range
216+ * clear channel values before an interrupt is generated
217+ */
218+static const int tcs3472_intr_pers[] = {
219+ 0, 1, 2, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
220+};
221+
222+static int tcs3472_read_event(struct iio_dev *indio_dev,
223+ const struct iio_chan_spec *chan, enum iio_event_type type,
224+ enum iio_event_direction dir, enum iio_event_info info, int *val,
225+ int *val2)
226+{
227+ struct tcs3472_data *data = iio_priv(indio_dev);
228+ int ret;
229+ unsigned int period;
230+
231+ mutex_lock(&data->lock);
232+
233+ switch (info) {
234+ case IIO_EV_INFO_VALUE:
235+ *val = (dir == IIO_EV_DIR_RISING) ?
236+ data->high_thresh : data->low_thresh;
237+ ret = IIO_VAL_INT;
238+ break;
239+ case IIO_EV_INFO_PERIOD:
240+ period = (256 - data->atime) * 2400 *
241+ tcs3472_intr_pers[data->apers];
242+ *val = period / USEC_PER_SEC;
243+ *val2 = period % USEC_PER_SEC;
244+ ret = IIO_VAL_INT_PLUS_MICRO;
245+ break;
246+ default:
247+ ret = -EINVAL;
248+ break;
249+ }
250+
251+ mutex_unlock(&data->lock);
252+
253+ return ret;
254+}
255+
256+static int tcs3472_write_event(struct iio_dev *indio_dev,
257+ const struct iio_chan_spec *chan, enum iio_event_type type,
258+ enum iio_event_direction dir, enum iio_event_info info, int val,
259+ int val2)
260+{
261+ struct tcs3472_data *data = iio_priv(indio_dev);
262+ int ret;
263+ u8 command;
264+ int period;
265+ int i;
266+
267+ mutex_lock(&data->lock);
268+ switch (info) {
269+ case IIO_EV_INFO_VALUE:
270+ switch (dir) {
271+ case IIO_EV_DIR_RISING:
272+ command = TCS3472_AIHT;
273+ break;
274+ case IIO_EV_DIR_FALLING:
275+ command = TCS3472_AILT;
276+ break;
277+ default:
278+ ret = -EINVAL;
279+ goto error;
280+ }
281+ ret = i2c_smbus_write_word_data(data->client, command, val);
282+ if (ret)
283+ goto error;
284+
285+ if (dir == IIO_EV_DIR_RISING)
286+ data->high_thresh = val;
287+ else
288+ data->low_thresh = val;
289+ break;
290+ case IIO_EV_INFO_PERIOD:
291+ period = val * USEC_PER_SEC + val2;
292+ for (i = 1; i < ARRAY_SIZE(tcs3472_intr_pers) - 1; i++) {
293+ if (period <= (256 - data->atime) * 2400 *
294+ tcs3472_intr_pers[i])
295+ break;
296+ }
297+ ret = i2c_smbus_write_byte_data(data->client, TCS3472_PERS, i);
298+ if (ret)
299+ goto error;
300+
301+ data->apers = i;
302+ break;
303+ default:
304+ ret = -EINVAL;
305+ break;
306+ }
307+error:
308+ mutex_unlock(&data->lock);
309+
310+ return ret;
311+}
312+
313+static int tcs3472_read_event_config(struct iio_dev *indio_dev,
314+ const struct iio_chan_spec *chan, enum iio_event_type type,
315+ enum iio_event_direction dir)
316+{
317+ struct tcs3472_data *data = iio_priv(indio_dev);
318+ int ret;
319+
320+ mutex_lock(&data->lock);
321+ ret = !!(data->enable & TCS3472_ENABLE_AIEN);
322+ mutex_unlock(&data->lock);
323+
324+ return ret;
325+}
326+
327+static int tcs3472_write_event_config(struct iio_dev *indio_dev,
328+ const struct iio_chan_spec *chan, enum iio_event_type type,
329+ enum iio_event_direction dir, int state)
330+{
331+ struct tcs3472_data *data = iio_priv(indio_dev);
332+ int ret = 0;
333+ u8 enable_old;
334+
335+ mutex_lock(&data->lock);
336+
337+ enable_old = data->enable;
338+
339+ if (state)
340+ data->enable |= TCS3472_ENABLE_AIEN;
341+ else
342+ data->enable &= ~TCS3472_ENABLE_AIEN;
343+
344+ if (enable_old != data->enable) {
345+ ret = i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
346+ data->enable);
347+ if (ret)
348+ data->enable = enable_old;
349+ }
350+ mutex_unlock(&data->lock);
351+
352+ return ret;
353+}
354+
355+static irqreturn_t tcs3472_event_handler(int irq, void *priv)
356+{
357+ struct iio_dev *indio_dev = priv;
358+ struct tcs3472_data *data = iio_priv(indio_dev);
359+ int ret;
360+
361+ ret = i2c_smbus_read_byte_data(data->client, TCS3472_STATUS);
362+ if (ret >= 0 && (ret & TCS3472_STATUS_AINT)) {
363+ iio_push_event(indio_dev, IIO_UNMOD_EVENT_CODE(IIO_INTENSITY, 0,
364+ IIO_EV_TYPE_THRESH,
365+ IIO_EV_DIR_EITHER),
366+ iio_get_time_ns(indio_dev));
367+
368+ i2c_smbus_read_byte_data(data->client, TCS3472_INTR_CLEAR);
369+ }
370+
371+ return IRQ_HANDLED;
372+}
373+
185374 static irqreturn_t tcs3472_trigger_handler(int irq, void *p)
186375 {
187376 struct iio_poll_func *pf = p;
@@ -245,8 +434,11 @@ static const struct attribute_group tcs3472_attribute_group = { · 57 unmodified lines
245434 static const struct iio_info tcs3472_info = {
246435 .read_raw = tcs3472_read_raw,
247436 .write_raw = tcs3472_write_raw,
437+ .read_event_value = tcs3472_read_event,
438+ .write_event_value = tcs3472_write_event,
439+ .read_event_config = tcs3472_read_event_config,
440+ .write_event_config = tcs3472_write_event_config,
248441 .attrs = &tcs3472_attribute_group,
249− .driver_module = THIS_MODULE,
250442 };
251443
252444 static int tcs3472_probe(struct i2c_client *client,
@@ -263,6 +455,7 @@ static int tcs3472_probe(struct i2c_client *client, · 10 unmodified lines
263455 data = iio_priv(indio_dev);
264456 i2c_set_clientdata(client, indio_dev);
265457 data->client = client;
458+ mutex_init(&data->lock);
266459
267460 indio_dev->dev.parent = &client->dev;
268461 indio_dev->info = &tcs3472_info;
@@ -292,12 +485,29 @@ static int tcs3472_probe(struct i2c_client *client, · 23 unmodified lines
292485 return ret;
293486 data->atime = ret;
294487
488+ ret = i2c_smbus_read_word_data(data->client, TCS3472_AILT);
489+ if (ret < 0)
490+ return ret;
491+ data->low_thresh = ret;
492+
493+ ret = i2c_smbus_read_word_data(data->client, TCS3472_AIHT);
494+ if (ret < 0)
495+ return ret;
496+ data->high_thresh = ret;
497+
498+ data->apers = 1;
499+ ret = i2c_smbus_write_byte_data(data->client, TCS3472_PERS,
500+ data->apers);
501+ if (ret < 0)
502+ return ret;
503+
295504 ret = i2c_smbus_read_byte_data(data->client, TCS3472_ENABLE);
296505 if (ret < 0)
297506 return ret;
298507
299508 /* enable device */
300509 data->enable = ret | TCS3472_ENABLE_PON | TCS3472_ENABLE_AEN;
510+ data->enable &= ~TCS3472_ENABLE_AIEN;
301511 ret = i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
302512 data->enable);
303513 if (ret < 0)
@@ -308,12 +518,24 @@ static int tcs3472_probe(struct i2c_client *client, · 4 unmodified lines
308518 if (ret < 0)
309519 return ret;
310520
521+ if (client->irq) {
522+ ret = request_threaded_irq(client->irq, NULL,
523+ tcs3472_event_handler,
524+ IRQF_TRIGGER_FALLING | IRQF_SHARED |
525+ IRQF_ONESHOT,
526+ client->name, indio_dev);
527+ if (ret)
528+ goto buffer_cleanup;
529+ }
530+
311531 ret = iio_device_register(indio_dev);
312532 if (ret < 0)
313− goto buffer_cleanup;
533+ goto free_irq;
314534
315535 return 0;
316536
537+free_irq:
538+ free_irq(client->irq, indio_dev);
317539 buffer_cleanup:
318540 iio_triggered_buffer_cleanup(indio_dev);
319541 return ret;
@@ -321,8 +543,19 @@ buffer_cleanup: · 1 unmodified line
321543
322544 static int tcs3472_powerdown(struct tcs3472_data *data)
323545 {
324− return i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
325− data->enable & ~(TCS3472_ENABLE_AEN | TCS3472_ENABLE_PON));
546+ int ret;
547+ u8 enable_mask = TCS3472_ENABLE_AEN | TCS3472_ENABLE_PON;
548+
549+ mutex_lock(&data->lock);
550+
551+ ret = i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
552+ data->enable & ~enable_mask);
553+ if (!ret)
554+ data->enable &= ~enable_mask;
555+
556+ mutex_unlock(&data->lock);
557+
558+ return ret;
326559 }
327560
328561 static int tcs3472_remove(struct i2c_client *client)
@@ -330,6 +563,7 @@ static int tcs3472_remove(struct i2c_client *client) · 1 unmodified line
330563 struct iio_dev *indio_dev = i2c_get_clientdata(client);
331564
332565 iio_device_unregister(indio_dev);
566+ free_irq(client->irq, indio_dev);
333567 iio_triggered_buffer_cleanup(indio_dev);
334568 tcs3472_powerdown(iio_priv(indio_dev));
335569
@@ -348,8 +582,19 @@ static int tcs3472_resume(struct device *dev) · 12 unmodified lines
348582 {
349583 struct tcs3472_data *data = iio_priv(i2c_get_clientdata(
350584 to_i2c_client(dev)));
351− return i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
352− data->enable | (TCS3472_ENABLE_AEN | TCS3472_ENABLE_PON));
585+ int ret;
586+ u8 enable_mask = TCS3472_ENABLE_AEN | TCS3472_ENABLE_PON;
587+
588+ mutex_lock(&data->lock);
589+
590+ ret = i2c_smbus_write_byte_data(data->client, TCS3472_ENABLE,
591+ data->enable | enable_mask);
592+ if (!ret)
593+ data->enable |= enable_mask;
594+
595+ mutex_unlock(&data->lock);
596+
597+ return ret;
353598 }
354599 #endif
355600
drivers/iio/light/tsl2563.c+0−2
@@ -697,13 +697,11 @@ static int tsl2563_read_interrupt_config(struct iio_dev *indio_dev, · 696 unmodified lines
697697 }
698698
699699 static const struct iio_info tsl2563_info_no_irq = {
700− .driver_module = THIS_MODULE,
701700 .read_raw = &tsl2563_read_raw,
702701 .write_raw = &tsl2563_write_raw,
703702 };
704703
705704 static const struct iio_info tsl2563_info = {
706− .driver_module = THIS_MODULE,
707705 .read_raw = &tsl2563_read_raw,
708706 .write_raw = &tsl2563_write_raw,
709707 .read_event_value = &tsl2563_read_thresh,
drivers/iio/light/tsl2583.c+0−1
@@ -804,7 +804,6 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev, · 803 unmodified lines
804804
805805 static const struct iio_info tsl2583_info = {
806806 .attrs = &tsl2583_attribute_group,
807− .driver_module = THIS_MODULE,
808807 .read_raw = tsl2583_read_raw,
809808 .write_raw = tsl2583_write_raw,
810809 };
drivers/iio/light/tsl4531.c+0−1
@@ -144,7 +144,6 @@ static const struct iio_info tsl4531_info = { · 143 unmodified lines
144144 .read_raw = tsl4531_read_raw,
145145 .write_raw = tsl4531_write_raw,
146146 .attrs = &tsl4531_attribute_group,
147− .driver_module = THIS_MODULE,
148147 };
149148
150149 static int tsl4531_check_id(struct i2c_client *client)
drivers/iio/light/us5182d.c+0−1
@@ -714,7 +714,6 @@ err: · 713 unmodified lines
714714 }
715715
716716 static const struct iio_info us5182d_info = {
717− .driver_module = THIS_MODULE,
718717 .read_raw = us5182d_read_raw,
719718 .write_raw = us5182d_write_raw,
720719 .attrs = &us5182d_attr_group,
drivers/iio/light/vcnl4000.c+0−1
@@ -155,7 +155,6 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev, · 154 unmodified lines
155155
156156 static const struct iio_info vcnl4000_info = {
157157 .read_raw = vcnl4000_read_raw,
158− .driver_module = THIS_MODULE,
159158 };
160159
161160 static int vcnl4000_probe(struct i2c_client *client,
drivers/iio/light/veml6070.c+0−1
@@ -136,7 +136,6 @@ static int veml6070_read_raw(struct iio_dev *indio_dev, · 135 unmodified lines
136136
137137 static const struct iio_info veml6070_info = {
138138 .read_raw = veml6070_read_raw,
139− .driver_module = THIS_MODULE,
140139 };
141140
142141 static int veml6070_probe(struct i2c_client *client,
drivers/iio/light/vl6180.c+69−58
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/err.h>
2525 #include <linux/of.h>
2626 #include <linux/delay.h>
27+#include <linux/util_macros.h>
2728
2829 #include <linux/iio/iio.h>
2930 #include <linux/iio/sysfs.h>
@@ -86,6 +87,8 @@ · 56 unmodified lines
8687 struct vl6180_data {
8788 struct i2c_client *client;
8889 struct mutex lock;
90+ unsigned int als_gain_milli;
91+ unsigned int als_it_ms;
8992 };
9093
9194 enum { VL6180_ALS, VL6180_RANGE, VL6180_PROX };
@@ -275,19 +278,17 @@ static const struct iio_chan_spec vl6180_channels[] = { · 183 unmodified lines
275278 };
276279
277280 /*
278− * Columns 3 & 4 represent the same value in decimal and hex notations.
279− * Kept in order to avoid the datatype conversion while reading the
280− * hardware_gain.
281+ * Available Ambient Light Sensor gain settings, 1/1000th, and
282+ * corresponding setting for the VL6180_ALS_GAIN register
281283 */
282−static const int vl6180_als_gain[8][4] = {
283− { 1, 0, 70, VL6180_ALS_GAIN_1 },
284− { 1, 250000, 69, VL6180_ALS_GAIN_1_25 },
285− { 1, 670000, 68, VL6180_ALS_GAIN_1_67 },
286− { 2, 500000, 67, VL6180_ALS_GAIN_2_5 },
287− { 5, 0, 66, VL6180_ALS_GAIN_5 },
288− { 10, 0, 65, VL6180_ALS_GAIN_10 },
289− { 20, 0, 64, VL6180_ALS_GAIN_20 },
290− { 40, 0, 71, VL6180_ALS_GAIN_40 }
284+static const int vl6180_als_gain_tab[8] = {
285+ 1000, 1250, 1670, 2500, 5000, 10000, 20000, 40000
286+};
287+static const u8 vl6180_als_gain_tab_bits[8] = {
288+ VL6180_ALS_GAIN_1, VL6180_ALS_GAIN_1_25,
289+ VL6180_ALS_GAIN_1_67, VL6180_ALS_GAIN_2_5,
290+ VL6180_ALS_GAIN_5, VL6180_ALS_GAIN_10,
291+ VL6180_ALS_GAIN_20, VL6180_ALS_GAIN_40
291292 };
292293
293294 static int vl6180_read_raw(struct iio_dev *indio_dev,
@@ -295,7 +296,7 @@ static int vl6180_read_raw(struct iio_dev *indio_dev, · 1 unmodified line
295296 int *val, int *val2, long mask)
296297 {
297298 struct vl6180_data *data = iio_priv(indio_dev);
298− int ret, i;
299+ int ret;
299300
300301 switch (mask) {
301302 case IIO_CHAN_INFO_RAW:
@@ -306,19 +307,20 @@ static int vl6180_read_raw(struct iio_dev *indio_dev, · 4 unmodified lines
306307
307308 return IIO_VAL_INT;
308309 case IIO_CHAN_INFO_INT_TIME:
309− ret = vl6180_read_word(data->client, VL6180_ALS_IT);
310− if (ret < 0)
311− return ret;
312− *val = 0; /* 1 count = 1ms (0 = 1ms) */
313− *val2 = (ret + 1) * 1000; /* convert to seconds */
310+ *val = data->als_it_ms;
311+ *val2 = 1000;
312+
313+ return IIO_VAL_FRACTIONAL;
314314
315− return IIO_VAL_INT_PLUS_MICRO;
316315 case IIO_CHAN_INFO_SCALE:
317316 switch (chan->type) {
318317 case IIO_LIGHT:
319− *val = 0; /* one ALS count is 0.32 Lux */
320− *val2 = 320000;
321− break;
318+ /* one ALS count is 0.32 Lux @ gain 1, IT 100 ms */
319+ *val = 32000; /* 0.32 * 1000 * 100 */
320+ *val2 = data->als_gain_milli * data->als_it_ms;
321+
322+ return IIO_VAL_FRACTIONAL;
323+
322324 case IIO_DISTANCE:
323325 *val = 0; /* sensor reports mm, scale to meter */
324326 *val2 = 1000;
@@ -329,17 +331,11 @@ static int vl6180_read_raw(struct iio_dev *indio_dev, · 4 unmodified lines
329331
330332 return IIO_VAL_INT_PLUS_MICRO;
331333 case IIO_CHAN_INFO_HARDWAREGAIN:
332− ret = vl6180_read_byte(data->client, VL6180_ALS_GAIN);
333− if (ret < 0)
334− return -EINVAL;
335− for (i = 0; i < ARRAY_SIZE(vl6180_als_gain); i++) {
336− if (ret == vl6180_als_gain[i][2]) {
337− *val = vl6180_als_gain[i][0];
338− *val2 = vl6180_als_gain[i][1];
339− }
340− }
334+ *val = data->als_gain_milli;
335+ *val2 = 1000;
336+
337+ return IIO_VAL_FRACTIONAL;
341338
342− return IIO_VAL_INT_PLUS_MICRO;
343339 default:
344340 return -EINVAL;
345341 }
@@ -365,37 +361,53 @@ static int vl6180_hold(struct vl6180_data *data, bool hold) · 19 unmodified lines
365361
366362 static int vl6180_set_als_gain(struct vl6180_data *data, int val, int val2)
367363 {
368− int i, ret;
369−
370− for (i = 0; i < ARRAY_SIZE(vl6180_als_gain); i++) {
371− if (val == vl6180_als_gain[i][0] &&
372− val2 == vl6180_als_gain[i][1]) {
373− mutex_lock(&data->lock);
374− ret = vl6180_hold(data, true);
375− if (ret < 0)
376− goto fail;
377− ret = vl6180_write_byte(data->client, VL6180_ALS_GAIN,
378− vl6180_als_gain[i][3]);
379−fail:
380− vl6180_hold(data, false);
381− mutex_unlock(&data->lock);
382− return ret;
383− }
384− }
364+ int i, ret, gain;
385365
386− return -EINVAL;
366+ if (val < 1 || val > 40)
367+ return -EINVAL;
368+
369+ gain = (val * 1000000 + val2) / 1000;
370+ if (gain < 1 || gain > 40000)
371+ return -EINVAL;
372+
373+ i = find_closest(gain, vl6180_als_gain_tab,
374+ ARRAY_SIZE(vl6180_als_gain_tab));
375+
376+ mutex_lock(&data->lock);
377+ ret = vl6180_hold(data, true);
378+ if (ret < 0)
379+ goto fail;
380+
381+ ret = vl6180_write_byte(data->client, VL6180_ALS_GAIN,
382+ vl6180_als_gain_tab_bits[i]);
383+
384+ if (ret >= 0)
385+ data->als_gain_milli = vl6180_als_gain_tab[i];
386+
387+fail:
388+ vl6180_hold(data, false);
389+ mutex_unlock(&data->lock);
390+ return ret;
387391 }
388392
389−static int vl6180_set_it(struct vl6180_data *data, int val2)
393+static int vl6180_set_it(struct vl6180_data *data, int val, int val2)
390394 {
391− int ret;
395+ int ret, it_ms;
396+
397+ it_ms = (val2 + 500) / 1000; /* round to ms */
398+ if (val != 0 || it_ms < 1 || it_ms > 512)
399+ return -EINVAL;
392400
393401 mutex_lock(&data->lock);
394402 ret = vl6180_hold(data, true);
395403 if (ret < 0)
396404 goto fail;
397− ret = vl6180_write_word(data->client, VL6180_ALS_IT,
398− (val2 - 500) / 1000); /* write value in ms */
405+
406+ ret = vl6180_write_word(data->client, VL6180_ALS_IT, it_ms - 1);
407+
408+ if (ret >= 0)
409+ data->als_it_ms = it_ms;
410+
399411 fail:
400412 vl6180_hold(data, false);
401413 mutex_unlock(&data->lock);
@@ -411,10 +423,8 @@ static int vl6180_write_raw(struct iio_dev *indio_dev, · 9 unmodified lines
411423
412424 switch (mask) {
413425 case IIO_CHAN_INFO_INT_TIME:
414− if (val != 0 || val2 < 500 || val2 >= 512500)
415− return -EINVAL;
426+ return vl6180_set_it(data, val, val2);
416427
417− return vl6180_set_it(data, val2);
418428 case IIO_CHAN_INFO_HARDWAREGAIN:
419429 if (chan->type != IIO_LIGHT)
420430 return -EINVAL;
@@ -429,7 +439,6 @@ static const struct iio_info vl6180_info = { · 8 unmodified lines
429439 .read_raw = vl6180_read_raw,
430440 .write_raw = vl6180_write_raw,
431441 .attrs = &vl6180_attribute_group,
432− .driver_module = THIS_MODULE,
433442 };
434443
435444 static int vl6180_init(struct vl6180_data *data)
@@ -468,11 +477,13 @@ static int vl6180_init(struct vl6180_data *data) · 32 unmodified lines
468477 return ret;
469478
470479 /* ALS integration time: 100ms */
480+ data->als_it_ms = 100;
471481 ret = vl6180_write_word(client, VL6180_ALS_IT, VL6180_ALS_IT_100);
472482 if (ret < 0)
473483 return ret;
474484
475485 /* ALS gain: 1 */
486+ data->als_gain_milli = 1000;
476487 ret = vl6180_write_byte(client, VL6180_ALS_GAIN, VL6180_ALS_GAIN_1);
477488 if (ret < 0)
478489 return ret;
drivers/iio/magnetometer/ak8974.c+0−1
@@ -658,7 +658,6 @@ static const unsigned long ak8974_scan_masks[] = { 0x7, 0 }; · 657 unmodified lines
658658
659659 static const struct iio_info ak8974_info = {
660660 .read_raw = &ak8974_read_raw,
661− .driver_module = THIS_MODULE,
662661 };
663662
664663 static bool ak8974_writeable_reg(struct device *dev, unsigned int reg)
drivers/iio/magnetometer/ak8975.c+0−1
@@ -781,7 +781,6 @@ static const unsigned long ak8975_scan_masks[] = { 0x7, 0 }; · 780 unmodified lines
781781
782782 static const struct iio_info ak8975_info = {
783783 .read_raw = &ak8975_read_raw,
784− .driver_module = THIS_MODULE,
785784 };
786785
787786 #ifdef CONFIG_ACPI
drivers/iio/magnetometer/bmc150_magn.c+0−2
@@ -651,7 +651,6 @@ static const struct iio_info bmc150_magn_info = { · 650 unmodified lines
651651 .attrs = &bmc150_magn_attrs_group,
652652 .read_raw = bmc150_magn_read_raw,
653653 .write_raw = bmc150_magn_write_raw,
654− .driver_module = THIS_MODULE,
655654 };
656655
657656 static const unsigned long bmc150_magn_scan_masks[] = {
@@ -811,7 +810,6 @@ err_unlock: · 153 unmodified lines
811810 static const struct iio_trigger_ops bmc150_magn_trigger_ops = {
812811 .set_trigger_state = bmc150_magn_data_rdy_trigger_set_state,
813812 .try_reenable = bmc150_magn_trig_try_reen,
814− .owner = THIS_MODULE,
815813 };
816814
817815 static int bmc150_magn_buffer_preenable(struct iio_dev *indio_dev)
drivers/iio/magnetometer/hid-sensor-magn-3d.c+0−1
@@ -282,7 +282,6 @@ static int magn_3d_write_raw(struct iio_dev *indio_dev, · 281 unmodified lines
282282 }
283283
284284 static const struct iio_info magn_3d_info = {
285− .driver_module = THIS_MODULE,
286285 .read_raw = &magn_3d_read_raw,
287286 .write_raw = &magn_3d_write_raw,
288287 };
drivers/iio/magnetometer/hmc5843_core.c+0−1
@@ -597,7 +597,6 @@ static const struct iio_info hmc5843_info = { · 596 unmodified lines
597597 .read_raw = &hmc5843_read_raw,
598598 .write_raw = &hmc5843_write_raw,
599599 .write_raw_get_fmt = &hmc5843_write_raw_get_fmt,
600− .driver_module = THIS_MODULE,
601600 };
602601
603602 static const unsigned long hmc5843_scan_masks[] = {0x7, 0};
drivers/iio/magnetometer/mag3110.c+0−1
@@ -333,7 +333,6 @@ static const struct iio_info mag3110_info = { · 332 unmodified lines
333333 .attrs = &mag3110_group,
334334 .read_raw = &mag3110_read_raw,
335335 .write_raw = &mag3110_write_raw,
336− .driver_module = THIS_MODULE,
337336 };
338337
339338 static const unsigned long mag3110_scan_masks[] = {0x7, 0xf, 0};
drivers/iio/magnetometer/mmc35240.c+0−1
@@ -418,7 +418,6 @@ static int mmc35240_write_raw(struct iio_dev *indio_dev, · 417 unmodified lines
418418 }
419419
420420 static const struct iio_info mmc35240_info = {
421− .driver_module = THIS_MODULE,
422421 .read_raw = mmc35240_read_raw,
423422 .write_raw = mmc35240_write_raw,
424423 .attrs = &mmc35240_attribute_group,
drivers/iio/magnetometer/st_magn_core.c+16−6
@@ -317,7 +317,14 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { · 316 unmodified lines
317317 },
318318 .drdy_irq = {
319319 /* drdy line is routed drdy pin */
320− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
320+ .stat_drdy = {
321+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
322+ .mask = 0x07,
323+ },
324+ },
325+ .sim = {
326+ .addr = 0x22,
327+ .value = BIT(2),
321328 },
322329 .multi_read_bit = true,
323330 .bootime = 2,
@@ -359,9 +366,14 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { · 35 unmodified lines
359366 .mask = 0x10,
360367 },
361368 .drdy_irq = {
362− .addr = 0x62,
363− .mask_int1 = 0x01,
364− .addr_stat_drdy = 0x67,
369+ .int1 = {
370+ .addr = 0x62,
371+ .mask = 0x01,
372+ },
373+ .stat_drdy = {
374+ .addr = 0x67,
375+ .mask = 0x07,
376+ },
365377 },
366378 .multi_read_bit = false,
367379 .bootime = 2,
@@ -438,7 +450,6 @@ static const struct attribute_group st_magn_attribute_group = { · 70 unmodified lines
438450 };
439451
440452 static const struct iio_info magn_info = {
441− .driver_module = THIS_MODULE,
442453 .attrs = &st_magn_attribute_group,
443454 .read_raw = &st_magn_read_raw,
444455 .write_raw = &st_magn_write_raw,
@@ -447,7 +458,6 @@ static const struct iio_info magn_info = { · 2 unmodified lines
447458
448459 #ifdef CONFIG_IIO_TRIGGER
449460 static const struct iio_trigger_ops st_magn_trigger_ops = {
450− .owner = THIS_MODULE,
451461 .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE,
452462 .validate_device = st_sensors_validate_device,
453463 };
drivers/iio/multiplexer/iio-mux.c+6−1
@@ -173,7 +173,6 @@ static const struct iio_info mux_info = { · 172 unmodified lines
173173 .read_raw = mux_read_raw,
174174 .read_avail = mux_read_avail,
175175 .write_raw = mux_write_raw,
176− .driver_module = THIS_MODULE,
177176 };
178177
179178 static ssize_t mux_read_ext_info(struct iio_dev *indio_dev, uintptr_t private,
@@ -285,6 +284,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux, · 105 unmodified lines
285284 child->ext_info_cache = devm_kzalloc(dev,
286285 sizeof(*child->ext_info_cache) *
287286 num_ext_info, GFP_KERNEL);
287+ if (!child->ext_info_cache)
288+ return -ENOMEM;
289+
288290 for (i = 0; i < num_ext_info; ++i) {
289291 child->ext_info_cache[i].size = -1;
290292
@@ -309,6 +311,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux, · 18 unmodified lines
309311
310312 child->ext_info_cache[i].data = devm_kmemdup(dev, page, ret + 1,
311313 GFP_KERNEL);
314+ if (!child->ext_info_cache[i].data)
315+ return -ENOMEM;
316+
312317 child->ext_info_cache[i].data[ret] = 0;
313318 child->ext_info_cache[i].size = ret;
314319 }
drivers/iio/orientation/hid-sensor-incl-3d.c+0−1
@@ -186,7 +186,6 @@ static int incl_3d_write_raw(struct iio_dev *indio_dev, · 185 unmodified lines
186186 }
187187
188188 static const struct iio_info incl_3d_info = {
189− .driver_module = THIS_MODULE,
190189 .read_raw = &incl_3d_read_raw,
191190 .write_raw = &incl_3d_write_raw,
192191 };
drivers/iio/orientation/hid-sensor-rotation.c+0−1
@@ -138,7 +138,6 @@ static int dev_rot_write_raw(struct iio_dev *indio_dev, · 137 unmodified lines
138138 }
139139
140140 static const struct iio_info dev_rot_info = {
141− .driver_module = THIS_MODULE,
142141 .read_raw_multi = &dev_rot_read_raw,
143142 .write_raw = &dev_rot_write_raw,
144143 };
drivers/iio/potentiometer/ds1803.c+0−1
@@ -110,7 +110,6 @@ static int ds1803_write_raw(struct iio_dev *indio_dev, · 109 unmodified lines
110110 static const struct iio_info ds1803_info = {
111111 .read_raw = ds1803_read_raw,
112112 .write_raw = ds1803_write_raw,
113− .driver_module = THIS_MODULE,
114113 };
115114
116115 static int ds1803_probe(struct i2c_client *client,
drivers/iio/potentiometer/max5481.c+0−2
@@ -119,7 +119,6 @@ static int max5481_write_raw(struct iio_dev *indio_dev, · 118 unmodified lines
119119 static const struct iio_info max5481_info = {
120120 .read_raw = max5481_read_raw,
121121 .write_raw = max5481_write_raw,
122− .driver_module = THIS_MODULE,
123122 };
124123
125124 #if defined(CONFIG_OF)
@@ -207,7 +206,6 @@ MODULE_DEVICE_TABLE(acpi, max5481_acpi_match); · 81 unmodified lines
207206 static struct spi_driver max5481_driver = {
208207 .driver = {
209208 .name = "max5481",
210− .owner = THIS_MODULE,
211209 .of_match_table = of_match_ptr(max5481_match),
212210 .acpi_match_table = ACPI_PTR(max5481_acpi_match),
213211 },
drivers/iio/potentiometer/max5487.c+0−2
@@ -83,7 +83,6 @@ static int max5487_write_raw(struct iio_dev *indio_dev, · 82 unmodified lines
8383 static const struct iio_info max5487_info = {
8484 .read_raw = max5487_read_raw,
8585 .write_raw = max5487_write_raw,
86− .driver_module = THIS_MODULE,
8786 };
8887
8988 static int max5487_spi_probe(struct spi_device *spi)
@@ -147,7 +146,6 @@ MODULE_DEVICE_TABLE(acpi, max5487_acpi_match); · 57 unmodified lines
147146 static struct spi_driver max5487_driver = {
148147 .driver = {
149148 .name = "max5487",
150− .owner = THIS_MODULE,
151149 .acpi_match_table = ACPI_PTR(max5487_acpi_match),
152150 },
153151 .id_table = max5487_id,
drivers/iio/potentiometer/mcp4131.c+0−1
@@ -237,7 +237,6 @@ static int mcp4131_write_raw(struct iio_dev *indio_dev, · 236 unmodified lines
237237 static const struct iio_info mcp4131_info = {
238238 .read_raw = mcp4131_read_raw,
239239 .write_raw = mcp4131_write_raw,
240− .driver_module = THIS_MODULE,
241240 };
242241
243242 static int mcp4131_probe(struct spi_device *spi)
drivers/iio/potentiometer/mcp4531.c+0−1
@@ -207,7 +207,6 @@ static const struct iio_info mcp4531_info = { · 206 unmodified lines
207207 .read_raw = mcp4531_read_raw,
208208 .read_avail = mcp4531_read_avail,
209209 .write_raw = mcp4531_write_raw,
210− .driver_module = THIS_MODULE,
211210 };
212211
213212 #ifdef CONFIG_OF
drivers/iio/potentiometer/tpl0102.c+0−1
@@ -106,7 +106,6 @@ static int tpl0102_write_raw(struct iio_dev *indio_dev, · 105 unmodified lines
106106 static const struct iio_info tpl0102_info = {
107107 .read_raw = tpl0102_read_raw,
108108 .write_raw = tpl0102_write_raw,
109− .driver_module = THIS_MODULE,
110109 };
111110
112111 static int tpl0102_probe(struct i2c_client *client,
drivers/iio/potentiostat/lmp91000.c+0−2
@@ -207,7 +207,6 @@ static int lmp91000_read_raw(struct iio_dev *indio_dev, · 206 unmodified lines
207207 }
208208
209209 static const struct iio_info lmp91000_info = {
210− .driver_module = THIS_MODULE,
211210 .read_raw = lmp91000_read_raw,
212211 };
213212
@@ -283,7 +282,6 @@ static int lmp91000_buffer_cb(const void *val, void *private) · 69 unmodified lines
283282 }
284283
285284 static const struct iio_trigger_ops lmp91000_trigger_ops = {
286− .owner = THIS_MODULE,
287285 };
288286
289287
drivers/iio/pressure/abp060mg.c+0−1
@@ -168,7 +168,6 @@ static int abp060mg_read_raw(struct iio_dev *indio_dev, · 167 unmodified lines
168168 }
169169
170170 static const struct iio_info abp060mg_info = {
171− .driver_module = THIS_MODULE,
172171 .read_raw = abp060mg_read_raw,
173172 };
174173
drivers/iio/pressure/bmp280-core.c+0−1
@@ -561,7 +561,6 @@ static const struct attribute_group bmp280_attrs_group = { · 560 unmodified lines
561561 };
562562
563563 static const struct iio_info bmp280_info = {
564− .driver_module = THIS_MODULE,
565564 .read_raw = &bmp280_read_raw,
566565 .write_raw = &bmp280_write_raw,
567566 .attrs = &bmp280_attrs_group,
drivers/iio/pressure/cros_ec_baro.c+0−3
@@ -120,14 +120,12 @@ static int cros_ec_baro_write(struct iio_dev *indio_dev, · 119 unmodified lines
120120 static const struct iio_info cros_ec_baro_info = {
121121 .read_raw = &cros_ec_baro_read,
122122 .write_raw = &cros_ec_baro_write,
123− .driver_module = THIS_MODULE,
124123 };
125124
126125 static int cros_ec_baro_probe(struct platform_device *pdev)
127126 {
128127 struct device *dev = &pdev->dev;
129128 struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
130− struct cros_ec_device *ec_device;
131129 struct iio_dev *indio_dev;
132130 struct cros_ec_baro_state *state;
133131 struct iio_chan_spec *channel;
@@ -137,7 +135,6 @@ static int cros_ec_baro_probe(struct platform_device *pdev) · 3 unmodified lines
137135 dev_warn(dev, "No CROS EC device found.\n");
138136 return -EINVAL;
139137 }
140− ec_device = ec_dev->ec_dev;
141138
142139 indio_dev = devm_iio_device_alloc(dev, sizeof(*state));
143140 if (!indio_dev)
drivers/iio/pressure/hid-sensor-press.c+0−1
@@ -160,7 +160,6 @@ static int press_write_raw(struct iio_dev *indio_dev, · 159 unmodified lines
160160 }
161161
162162 static const struct iio_info press_info = {
163− .driver_module = THIS_MODULE,
164163 .read_raw = &press_read_raw,
165164 .write_raw = &press_write_raw,
166165 };
drivers/iio/pressure/hp03.c+0−1
@@ -208,7 +208,6 @@ static int hp03_read_raw(struct iio_dev *indio_dev, · 207 unmodified lines
208208 }
209209
210210 static const struct iio_info hp03_info = {
211− .driver_module = THIS_MODULE,
212211 .read_raw = &hp03_read_raw,
213212 };
214213
drivers/iio/pressure/hp206c.c+0−1
@@ -351,7 +351,6 @@ static const struct iio_info hp206c_info = { · 350 unmodified lines
351351 .attrs = &hp206c_attribute_group,
352352 .read_raw = hp206c_read_raw,
353353 .write_raw = hp206c_write_raw,
354− .driver_module = THIS_MODULE,
355354 };
356355
357356 static int hp206c_probe(struct i2c_client *client,
drivers/iio/pressure/mpl115.c+0−1
@@ -144,7 +144,6 @@ static const struct iio_chan_spec mpl115_channels[] = { · 143 unmodified lines
144144
145145 static const struct iio_info mpl115_info = {
146146 .read_raw = &mpl115_read_raw,
147− .driver_module = THIS_MODULE,
148147 };
149148
150149 int mpl115_probe(struct device *dev, const char *name,
drivers/iio/pressure/mpl3115.c+0−1
@@ -218,7 +218,6 @@ static const struct iio_chan_spec mpl3115_channels[] = { · 217 unmodified lines
218218
219219 static const struct iio_info mpl3115_info = {
220220 .read_raw = &mpl3115_read_raw,
221− .driver_module = THIS_MODULE,
222221 };
223222
224223 static int mpl3115_probe(struct i2c_client *client,
drivers/iio/pressure/ms5611_core.c+0−1
@@ -384,7 +384,6 @@ static const struct iio_info ms5611_info = { · 383 unmodified lines
384384 .read_raw = &ms5611_read_raw,
385385 .write_raw = &ms5611_write_raw,
386386 .attrs = &ms5611_attribute_group,
387− .driver_module = THIS_MODULE,
388387 };
389388
390389 static int ms5611_init(struct iio_dev *indio_dev)
drivers/iio/pressure/ms5637.c+0−1
@@ -124,7 +124,6 @@ static const struct iio_info ms5637_info = { · 123 unmodified lines
124124 .read_raw = ms5637_read_raw,
125125 .write_raw = ms5637_write_raw,
126126 .attrs = &ms5637_attribute_group,
127− .driver_module = THIS_MODULE,
128127 };
129128
130129 static int ms5637_probe(struct i2c_client *client,
drivers/iio/pressure/st_pressure.h+4−0
@@ -19,6 +19,8 @@ enum st_press_type { · 18 unmodified lines
1919 LPS25H,
2020 LPS331AP,
2121 LPS22HB,
22+ LPS33HW,
23+ LPS35HW,
2224 ST_PRESS_MAX,
2325 };
2426
@@ -26,6 +28,8 @@ enum st_press_type { · 1 unmodified line
2628 #define LPS25H_PRESS_DEV_NAME "lps25h"
2729 #define LPS331AP_PRESS_DEV_NAME "lps331ap"
2830 #define LPS22HB_PRESS_DEV_NAME "lps22hb"
31+#define LPS33HW_PRESS_DEV_NAME "lps33hw"
32+#define LPS35HW_PRESS_DEV_NAME "lps35hw"
2933
3034 /**
3135 * struct st_sensors_platform_data - default press platform data
drivers/iio/pressure/st_pressure_core.c+55−23
@@ -280,14 +280,28 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 279 unmodified lines
280280 .mask = 0x04,
281281 },
282282 .drdy_irq = {
283− .addr = 0x22,
284− .mask_int1 = 0x04,
285− .mask_int2 = 0x20,
283+ .int1 = {
284+ .addr = 0x22,
285+ .mask = 0x04,
286+ .addr_od = 0x22,
287+ .mask_od = 0x40,
288+ },
289+ .int2 = {
290+ .addr = 0x22,
291+ .mask = 0x20,
292+ .addr_od = 0x22,
293+ .mask_od = 0x40,
294+ },
286295 .addr_ihl = 0x22,
287296 .mask_ihl = 0x80,
288− .addr_od = 0x22,
289− .mask_od = 0x40,
290− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
297+ .stat_drdy = {
298+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
299+ .mask = 0x03,
300+ },
301+ },
302+ .sim = {
303+ .addr = 0x20,
304+ .value = BIT(0),
291305 },
292306 .multi_read_bit = true,
293307 .bootime = 2,
@@ -335,8 +349,9 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 41 unmodified lines
335349 .addr = 0x20,
336350 .mask = 0x04,
337351 },
338− .drdy_irq = {
339− .addr = 0,
352+ .sim = {
353+ .addr = 0x20,
354+ .value = BIT(0),
340355 },
341356 .multi_read_bit = true,
342357 .bootime = 2,
@@ -388,14 +403,22 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 45 unmodified lines
388403 .mask = 0x04,
389404 },
390405 .drdy_irq = {
391− .addr = 0x23,
392− .mask_int1 = 0x01,
393− .mask_int2 = 0x00,
406+ .int1 = {
407+ .addr = 0x23,
408+ .mask = 0x01,
409+ .addr_od = 0x22,
410+ .mask_od = 0x40,
411+ },
394412 .addr_ihl = 0x22,
395413 .mask_ihl = 0x80,
396− .addr_od = 0x22,
397− .mask_od = 0x40,
398− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
414+ .stat_drdy = {
415+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
416+ .mask = 0x03,
417+ },
418+ },
419+ .sim = {
420+ .addr = 0x20,
421+ .value = BIT(0),
399422 },
400423 .multi_read_bit = true,
401424 .bootime = 2,
@@ -410,6 +433,8 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 8 unmodified lines
410433 .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
411434 .sensors_supported = {
412435 [0] = LPS22HB_PRESS_DEV_NAME,
436+ [1] = LPS33HW_PRESS_DEV_NAME,
437+ [2] = LPS35HW_PRESS_DEV_NAME,
413438 },
414439 .ch = (struct iio_chan_spec *)st_press_lps22hb_channels,
415440 .num_ch = ARRAY_SIZE(st_press_lps22hb_channels),
@@ -447,14 +472,22 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 31 unmodified lines
447472 .mask = 0x02,
448473 },
449474 .drdy_irq = {
450− .addr = 0x12,
451− .mask_int1 = 0x04,
452− .mask_int2 = 0x00,
475+ .int1 = {
476+ .addr = 0x12,
477+ .mask = 0x04,
478+ .addr_od = 0x12,
479+ .mask_od = 0x40,
480+ },
453481 .addr_ihl = 0x12,
454482 .mask_ihl = 0x80,
455− .addr_od = 0x12,
456− .mask_od = 0x40,
457− .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
483+ .stat_drdy = {
484+ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
485+ .mask = 0x03,
486+ },
487+ },
488+ .sim = {
489+ .addr = 0x10,
490+ .value = BIT(0),
458491 },
459492 .multi_read_bit = false,
460493 .bootime = 2,
@@ -547,7 +580,6 @@ static const struct attribute_group st_press_attribute_group = { · 86 unmodified lines
547580 };
548581
549582 static const struct iio_info press_info = {
550− .driver_module = THIS_MODULE,
551583 .attrs = &st_press_attribute_group,
552584 .read_raw = &st_press_read_raw,
553585 .write_raw = &st_press_write_raw,
@@ -556,7 +588,6 @@ static const struct iio_info press_info = { · 2 unmodified lines
556588
557589 #ifdef CONFIG_IIO_TRIGGER
558590 static const struct iio_trigger_ops st_press_trigger_ops = {
559− .owner = THIS_MODULE,
560591 .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE,
561592 .validate_device = st_sensors_validate_device,
562593 };
@@ -605,7 +636,8 @@ int st_press_common_probe(struct iio_dev *indio_dev) · 42 unmodified lines
605636 press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
606637
607638 /* Some devices don't support a data ready pin. */
608− if (!pdata && press_data->sensor_settings->drdy_irq.addr)
639+ if (!pdata && (press_data->sensor_settings->drdy_irq.int1.addr ||
640+ press_data->sensor_settings->drdy_irq.int2.addr))
609641 pdata = (struct st_sensors_platform_data *)&default_press_pdata;
610642
611643 err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
drivers/iio/pressure/st_pressure_i2c.c+10−0
@@ -37,6 +37,14 @@ static const struct of_device_id st_press_of_match[] = { · 36 unmodified lines
3737 .compatible = "st,lps22hb-press",
3838 .data = LPS22HB_PRESS_DEV_NAME,
3939 },
40+ {
41+ .compatible = "st,lps33hw",
42+ .data = LPS33HW_PRESS_DEV_NAME,
43+ },
44+ {
45+ .compatible = "st,lps35hw",
46+ .data = LPS35HW_PRESS_DEV_NAME,
47+ },
4048 {},
4149 };
4250 MODULE_DEVICE_TABLE(of, st_press_of_match);
@@ -59,6 +67,8 @@ static const struct i2c_device_id st_press_id_table[] = { · 16 unmodified lines
5967 { LPS25H_PRESS_DEV_NAME, LPS25H },
6068 { LPS331AP_PRESS_DEV_NAME, LPS331AP },
6169 { LPS22HB_PRESS_DEV_NAME, LPS22HB },
70+ { LPS33HW_PRESS_DEV_NAME, LPS33HW },
71+ { LPS35HW_PRESS_DEV_NAME, LPS35HW },
6272 {},
6373 };
6474 MODULE_DEVICE_TABLE(i2c, st_press_id_table);
drivers/iio/pressure/st_pressure_spi.c+10−0
@@ -41,6 +41,14 @@ static const struct of_device_id st_press_of_match[] = { · 40 unmodified lines
4141 .compatible = "st,lps22hb-press",
4242 .data = LPS22HB_PRESS_DEV_NAME,
4343 },
44+ {
45+ .compatible = "st,lps33hw",
46+ .data = LPS33HW_PRESS_DEV_NAME,
47+ },
48+ {
49+ .compatible = "st,lps35hw",
50+ .data = LPS35HW_PRESS_DEV_NAME,
51+ },
4452 {},
4553 };
4654 MODULE_DEVICE_TABLE(of, st_press_of_match);
@@ -83,6 +91,8 @@ static const struct spi_device_id st_press_id_table[] = { · 36 unmodified lines
8391 { LPS25H_PRESS_DEV_NAME },
8492 { LPS331AP_PRESS_DEV_NAME },
8593 { LPS22HB_PRESS_DEV_NAME },
94+ { LPS33HW_PRESS_DEV_NAME },
95+ { LPS35HW_PRESS_DEV_NAME },
8696 {},
8797 };
8898 MODULE_DEVICE_TABLE(spi, st_press_id_table);
drivers/iio/pressure/t5403.c+0−1
@@ -209,7 +209,6 @@ static const struct iio_info t5403_info = { · 208 unmodified lines
209209 .read_raw = &t5403_read_raw,
210210 .write_raw = &t5403_write_raw,
211211 .attrs = &t5403_attribute_group,
212− .driver_module = THIS_MODULE,
213212 };
214213
215214 static int t5403_probe(struct i2c_client *client,
drivers/iio/pressure/zpa2326.c+0−2
@@ -1390,7 +1390,6 @@ static int zpa2326_set_trigger_state(struct iio_trigger *trig, bool state) · 1389 unmodified lines
13901390 }
13911391
13921392 static const struct iio_trigger_ops zpa2326_trigger_ops = {
1393− .owner = THIS_MODULE,
13941393 .set_trigger_state = zpa2326_set_trigger_state,
13951394 };
13961395
@@ -1590,7 +1589,6 @@ static const struct iio_chan_spec zpa2326_channels[] = { · 193 unmodified lines
15901589 };
15911590
15921591 static const struct iio_info zpa2326_info = {
1593− .driver_module = THIS_MODULE,
15941592 .attrs = &zpa2326_attribute_group,
15951593 .read_raw = zpa2326_read_raw,
15961594 .write_raw = zpa2326_write_raw,
drivers/iio/proximity/Kconfig+10−0
@@ -32,6 +32,16 @@ config LIDAR_LITE_V2 · 31 unmodified lines
3232 To compile this driver as a module, choose M here: the
3333 module will be called pulsedlight-lite-v2
3434
35+config RFD77402
36+ tristate "RFD77402 ToF sensor"
37+ depends on I2C
38+ help
39+ Say Y to build a driver for the RFD77420 Time-of-Flight (distance)
40+ sensor module with I2C interface.
41+
42+ To compile this driver as a module, choose M here: the
43+ module will be called rfd77402.
44+
3545 config SRF04
3646 tristate "Devantech SRF04 ultrasonic ranger sensor"
3747 depends on GPIOLIB
drivers/iio/proximity/Makefile+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 # When adding new entries keep the list in alphabetical order
77 obj-$(CONFIG_AS3935) += as3935.o
88 obj-$(CONFIG_LIDAR_LITE_V2) += pulsedlight-lidar-lite-v2.o
9+obj-$(CONFIG_RFD77402) += rfd77402.o
910 obj-$(CONFIG_SRF04) += srf04.o
1011 obj-$(CONFIG_SRF08) += srf08.o
1112 obj-$(CONFIG_SX9500) += sx9500.o
drivers/iio/proximity/as3935.c+0−2
@@ -221,7 +221,6 @@ static int as3935_read_raw(struct iio_dev *indio_dev, · 220 unmodified lines
221221 }
222222
223223 static const struct iio_info as3935_info = {
224− .driver_module = THIS_MODULE,
225224 .attrs = &as3935_attribute_group,
226225 .read_raw = &as3935_read_raw,
227226 };
@@ -247,7 +246,6 @@ err_read: · 19 unmodified lines
247246 }
248247
249248 static const struct iio_trigger_ops iio_interrupt_trigger_ops = {
250− .owner = THIS_MODULE,
251249 };
252250
253251 static void as3935_event_work(struct work_struct *work)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c+0−1
@@ -249,7 +249,6 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private) · 248 unmodified lines
249249 }
250250
251251 static const struct iio_info lidar_info = {
252− .driver_module = THIS_MODULE,
253252 .read_raw = lidar_read_raw,
254253 };
255254
drivers/iio/proximity/rfd77402.c+352−0
@@ -0,0 +1,352 @@
1+/*
2+ * rfd77402.c - Support for RF Digital RFD77402 Time-of-Flight (distance) sensor
3+ *
4+ * Copyright 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net>
5+ *
6+ * This file is subject to the terms and conditions of version 2 of
7+ * the GNU General Public License. See the file COPYING in the main
8+ * directory of this archive for more details.
9+ *
10+ * 7-bit I2C slave address 0x4c
11+ *
12+ * TODO: interrupt
13+ * https://media.digikey.com/pdf/Data%20Sheets/RF%20Digital%20PDFs/RFD77402.pdf
14+ */
15+
16+#include <linux/module.h>
17+#include <linux/i2c.h>
18+#include <linux/delay.h>
19+
20+#include <linux/iio/iio.h>
21+
22+#define RFD77402_DRV_NAME "rfd77402"
23+
24+#define RFD77402_ICSR 0x00 /* Interrupt Control Status Register */
25+#define RFD77402_ICSR_INT_MODE BIT(2)
26+#define RFD77402_ICSR_INT_POL BIT(3)
27+#define RFD77402_ICSR_RESULT BIT(4)
28+#define RFD77402_ICSR_M2H_MSG BIT(5)
29+#define RFD77402_ICSR_H2M_MSG BIT(6)
30+#define RFD77402_ICSR_RESET BIT(7)
31+
32+#define RFD77402_CMD_R 0x04
33+#define RFD77402_CMD_SINGLE 0x01
34+#define RFD77402_CMD_STANDBY 0x10
35+#define RFD77402_CMD_MCPU_OFF 0x11
36+#define RFD77402_CMD_MCPU_ON 0x12
37+#define RFD77402_CMD_RESET BIT(6)
38+#define RFD77402_CMD_VALID BIT(7)
39+
40+#define RFD77402_STATUS_R 0x06
41+#define RFD77402_STATUS_PM_MASK GENMASK(4, 0)
42+#define RFD77402_STATUS_STANDBY 0x00
43+#define RFD77402_STATUS_MCPU_OFF 0x10
44+#define RFD77402_STATUS_MCPU_ON 0x18
45+
46+#define RFD77402_RESULT_R 0x08
47+#define RFD77402_RESULT_DIST_MASK GENMASK(12, 2)
48+#define RFD77402_RESULT_ERR_MASK GENMASK(14, 13)
49+#define RFD77402_RESULT_VALID BIT(15)
50+
51+#define RFD77402_PMU_CFG 0x14
52+#define RFD77402_PMU_MCPU_INIT BIT(9)
53+
54+#define RFD77402_I2C_INIT_CFG 0x1c
55+#define RFD77402_I2C_ADDR_INCR BIT(0)
56+#define RFD77402_I2C_DATA_INCR BIT(2)
57+#define RFD77402_I2C_HOST_DEBUG BIT(5)
58+#define RFD77402_I2C_MCPU_DEBUG BIT(6)
59+
60+#define RFD77402_CMD_CFGR_A 0x0c
61+#define RFD77402_CMD_CFGR_B 0x0e
62+#define RFD77402_HFCFG_0 0x20
63+#define RFD77402_HFCFG_1 0x22
64+#define RFD77402_HFCFG_2 0x24
65+#define RFD77402_HFCFG_3 0x26
66+
67+#define RFD77402_MOD_CHIP_ID 0x28
68+
69+/* magic configuration values from datasheet */
70+static const struct {
71+ u8 reg;
72+ u16 val;
73+} rf77402_tof_config[] = {
74+ {RFD77402_CMD_CFGR_A, 0xe100},
75+ {RFD77402_CMD_CFGR_B, 0x10ff},
76+ {RFD77402_HFCFG_0, 0x07d0},
77+ {RFD77402_HFCFG_1, 0x5008},
78+ {RFD77402_HFCFG_2, 0xa041},
79+ {RFD77402_HFCFG_3, 0x45d4},
80+};
81+
82+struct rfd77402_data {
83+ struct i2c_client *client;
84+ /* Serialize reads from the sensor */
85+ struct mutex lock;
86+};
87+
88+static const struct iio_chan_spec rfd77402_channels[] = {
89+ {
90+ .type = IIO_DISTANCE,
91+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
92+ BIT(IIO_CHAN_INFO_SCALE),
93+ },
94+};
95+
96+static int rfd77402_set_state(struct rfd77402_data *data, u8 state, u16 check)
97+{
98+ int ret;
99+
100+ ret = i2c_smbus_write_byte_data(data->client, RFD77402_CMD_R,
101+ state | RFD77402_CMD_VALID);
102+ if (ret < 0)
103+ return ret;
104+
105+ usleep_range(10000, 20000);
106+
107+ ret = i2c_smbus_read_word_data(data->client, RFD77402_STATUS_R);
108+ if (ret < 0)
109+ return ret;
110+ if ((ret & RFD77402_STATUS_PM_MASK) != check)
111+ return -ENODEV;
112+
113+ return 0;
114+}
115+
116+static int rfd77402_measure(struct rfd77402_data *data)
117+{
118+ int ret;
119+ int tries = 10;
120+
121+ ret = rfd77402_set_state(data, RFD77402_CMD_MCPU_ON,
122+ RFD77402_STATUS_MCPU_ON);
123+ if (ret < 0)
124+ return ret;
125+
126+ ret = i2c_smbus_write_byte_data(data->client, RFD77402_CMD_R,
127+ RFD77402_CMD_SINGLE |
128+ RFD77402_CMD_VALID);
129+ if (ret < 0)
130+ goto err;
131+
132+ while (tries-- > 0) {
133+ ret = i2c_smbus_read_byte_data(data->client, RFD77402_ICSR);
134+ if (ret < 0)
135+ goto err;
136+ if (ret & RFD77402_ICSR_RESULT)
137+ break;
138+ msleep(20);
139+ }
140+
141+ if (tries < 0) {
142+ ret = -ETIMEDOUT;
143+ goto err;
144+ }
145+
146+ ret = i2c_smbus_read_word_data(data->client, RFD77402_RESULT_R);
147+ if (ret < 0)
148+ goto err;
149+
150+ if ((ret & RFD77402_RESULT_ERR_MASK) ||
151+ !(ret & RFD77402_RESULT_VALID)) {
152+ ret = -EIO;
153+ goto err;
154+ }
155+
156+ return (ret & RFD77402_RESULT_DIST_MASK) >> 2;
157+
158+err:
159+ rfd77402_set_state(data, RFD77402_CMD_MCPU_OFF,
160+ RFD77402_STATUS_MCPU_OFF);
161+ return ret;
162+}
163+
164+static int rfd77402_read_raw(struct iio_dev *indio_dev,
165+ struct iio_chan_spec const *chan,
166+ int *val, int *val2, long mask)
167+{
168+ struct rfd77402_data *data = iio_priv(indio_dev);
169+ int ret;
170+
171+ switch (mask) {
172+ case IIO_CHAN_INFO_RAW:
173+ mutex_lock(&data->lock);
174+ ret = rfd77402_measure(data);
175+ mutex_unlock(&data->lock);
176+ if (ret < 0)
177+ return ret;
178+ *val = ret;
179+ return IIO_VAL_INT;
180+ case IIO_CHAN_INFO_SCALE:
181+ /* 1 LSB is 1 mm */
182+ *val = 0;
183+ *val2 = 1000;
184+ return IIO_VAL_INT_PLUS_MICRO;
185+ default:
186+ return -EINVAL;
187+ }
188+}
189+
190+static const struct iio_info rfd77402_info = {
191+ .read_raw = rfd77402_read_raw,
192+};
193+
194+static int rfd77402_init(struct rfd77402_data *data)
195+{
196+ int ret, i;
197+
198+ ret = rfd77402_set_state(data, RFD77402_CMD_STANDBY,
199+ RFD77402_STATUS_STANDBY);
200+ if (ret < 0)
201+ return ret;
202+
203+ /* configure INT pad as push-pull, active low */
204+ ret = i2c_smbus_write_byte_data(data->client, RFD77402_ICSR,
205+ RFD77402_ICSR_INT_MODE);
206+ if (ret < 0)
207+ return ret;
208+
209+ /* I2C configuration */
210+ ret = i2c_smbus_write_word_data(data->client, RFD77402_I2C_INIT_CFG,
211+ RFD77402_I2C_ADDR_INCR |
212+ RFD77402_I2C_DATA_INCR |
213+ RFD77402_I2C_HOST_DEBUG |
214+ RFD77402_I2C_MCPU_DEBUG);
215+ if (ret < 0)
216+ return ret;
217+
218+ /* set initialization */
219+ ret = i2c_smbus_write_word_data(data->client, RFD77402_PMU_CFG, 0x0500);
220+ if (ret < 0)
221+ return ret;
222+
223+ ret = rfd77402_set_state(data, RFD77402_CMD_MCPU_OFF,
224+ RFD77402_STATUS_MCPU_OFF);
225+ if (ret < 0)
226+ return ret;
227+
228+ /* set initialization */
229+ ret = i2c_smbus_write_word_data(data->client, RFD77402_PMU_CFG, 0x0600);
230+ if (ret < 0)
231+ return ret;
232+
233+ ret = rfd77402_set_state(data, RFD77402_CMD_MCPU_ON,
234+ RFD77402_STATUS_MCPU_ON);
235+ if (ret < 0)
236+ return ret;
237+
238+ for (i = 0; i < ARRAY_SIZE(rf77402_tof_config); i++) {
239+ ret = i2c_smbus_write_word_data(data->client,
240+ rf77402_tof_config[i].reg,
241+ rf77402_tof_config[i].val);
242+ if (ret < 0)
243+ return ret;
244+ }
245+
246+ ret = rfd77402_set_state(data, RFD77402_CMD_STANDBY,
247+ RFD77402_STATUS_STANDBY);
248+
249+ return ret;
250+}
251+
252+static int rfd77402_powerdown(struct rfd77402_data *data)
253+{
254+ return rfd77402_set_state(data, RFD77402_CMD_STANDBY,
255+ RFD77402_STATUS_STANDBY);
256+}
257+
258+static int rfd77402_probe(struct i2c_client *client,
259+ const struct i2c_device_id *id)
260+{
261+ struct rfd77402_data *data;
262+ struct iio_dev *indio_dev;
263+ int ret;
264+
265+ ret = i2c_smbus_read_word_data(client, RFD77402_MOD_CHIP_ID);
266+ if (ret < 0)
267+ return ret;
268+ if (ret != 0xad01 && ret != 0xad02) /* known chip ids */
269+ return -ENODEV;
270+
271+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
272+ if (!indio_dev)
273+ return -ENOMEM;
274+
275+ data = iio_priv(indio_dev);
276+ i2c_set_clientdata(client, indio_dev);
277+ data->client = client;
278+ mutex_init(&data->lock);
279+
280+ indio_dev->dev.parent = &client->dev;
281+ indio_dev->info = &rfd77402_info;
282+ indio_dev->channels = rfd77402_channels;
283+ indio_dev->num_channels = ARRAY_SIZE(rfd77402_channels);
284+ indio_dev->name = RFD77402_DRV_NAME;
285+ indio_dev->modes = INDIO_DIRECT_MODE;
286+
287+ ret = rfd77402_init(data);
288+ if (ret < 0)
289+ return ret;
290+
291+ ret = iio_device_register(indio_dev);
292+ if (ret)
293+ goto err_powerdown;
294+
295+ return 0;
296+
297+err_powerdown:
298+ rfd77402_powerdown(data);
299+ return ret;
300+}
301+
302+static int rfd77402_remove(struct i2c_client *client)
303+{
304+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
305+
306+ iio_device_unregister(indio_dev);
307+ rfd77402_powerdown(iio_priv(indio_dev));
308+
309+ return 0;
310+}
311+
312+#ifdef CONFIG_PM_SLEEP
313+static int rfd77402_suspend(struct device *dev)
314+{
315+ struct rfd77402_data *data = iio_priv(i2c_get_clientdata(
316+ to_i2c_client(dev)));
317+
318+ return rfd77402_powerdown(data);
319+}
320+
321+static int rfd77402_resume(struct device *dev)
322+{
323+ struct rfd77402_data *data = iio_priv(i2c_get_clientdata(
324+ to_i2c_client(dev)));
325+
326+ return rfd77402_init(data);
327+}
328+#endif
329+
330+static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume);
331+
332+static const struct i2c_device_id rfd77402_id[] = {
333+ { "rfd77402", 0},
334+ { }
335+};
336+MODULE_DEVICE_TABLE(i2c, rfd77402_id);
337+
338+static struct i2c_driver rfd77402_driver = {
339+ .driver = {
340+ .name = RFD77402_DRV_NAME,
341+ .pm = &rfd77402_pm_ops,
342+ },
343+ .probe = rfd77402_probe,
344+ .remove = rfd77402_remove,
345+ .id_table = rfd77402_id,
346+};
347+
348+module_i2c_driver(rfd77402_driver);
349+
350+MODULE_AUTHOR("Peter Meerwald-Stadler <pmeerw@pmeerw.net>");
351+MODULE_DESCRIPTION("RFD77402 Time-of-Flight sensor driver");
352+MODULE_LICENSE("GPL");
drivers/iio/proximity/srf04.c+0−1
@@ -203,7 +203,6 @@ static int srf04_read_raw(struct iio_dev *indio_dev, · 202 unmodified lines
203203 }
204204
205205 static const struct iio_info srf04_iio_info = {
206− .driver_module = THIS_MODULE,
207206 .read_raw = srf04_read_raw,
208207 };
209208
drivers/iio/proximity/srf08.c+0−2
@@ -436,7 +436,6 @@ static const struct iio_chan_spec srf08_channels[] = { · 435 unmodified lines
436436 static const struct iio_info srf08_info = {
437437 .read_raw = srf08_read_raw,
438438 .attrs = &srf08_attribute_group,
439− .driver_module = THIS_MODULE,
440439 };
441440
442441 /*
@@ -445,7 +444,6 @@ static const struct iio_info srf08_info = { · 2 unmodified lines
445444 */
446445 static const struct iio_info srf02_info = {
447446 .read_raw = srf08_read_raw,
448− .driver_module = THIS_MODULE,
449447 };
450448
451449 static int srf08_probe(struct i2c_client *client,
drivers/iio/proximity/sx9500.c+0−2
@@ -615,7 +615,6 @@ static const struct attribute_group sx9500_attribute_group = { · 614 unmodified lines
615615 };
616616
617617 static const struct iio_info sx9500_info = {
618− .driver_module = THIS_MODULE,
619618 .attrs = &sx9500_attribute_group,
620619 .read_raw = &sx9500_read_raw,
621620 .write_raw = &sx9500_write_raw,
@@ -650,7 +649,6 @@ out: · 28 unmodified lines
650649
651650 static const struct iio_trigger_ops sx9500_trigger_ops = {
652651 .set_trigger_state = sx9500_set_trigger_state,
653− .owner = THIS_MODULE,
654652 };
655653
656654 static irqreturn_t sx9500_trigger_handler(int irq, void *private)
drivers/iio/temperature/hid-sensor-temperature.c+0−1
@@ -123,7 +123,6 @@ static int temperature_write_raw(struct iio_dev *indio_dev, · 122 unmodified lines
123123 }
124124
125125 static const struct iio_info temperature_info = {
126− .driver_module = THIS_MODULE,
127126 .read_raw = &temperature_read_raw,
128127 .write_raw = &temperature_write_raw,
129128 };
drivers/iio/temperature/maxim_thermocouple.c+0−1
@@ -208,7 +208,6 @@ static int maxim_thermocouple_read_raw(struct iio_dev *indio_dev, · 207 unmodified lines
208208 }
209209
210210 static const struct iio_info maxim_thermocouple_info = {
211− .driver_module = THIS_MODULE,
212211 .read_raw = maxim_thermocouple_read_raw,
213212 };
214213
drivers/iio/temperature/mlx90614.c+0−1
@@ -400,7 +400,6 @@ static const struct iio_info mlx90614_info = { · 399 unmodified lines
400400 .write_raw = mlx90614_write_raw,
401401 .write_raw_get_fmt = mlx90614_write_raw_get_fmt,
402402 .attrs = &mlx90614_attr_group,
403− .driver_module = THIS_MODULE,
404403 };
405404
406405 #ifdef CONFIG_PM
drivers/iio/temperature/tmp006.c+0−1
@@ -179,7 +179,6 @@ static const struct iio_info tmp006_info = { · 178 unmodified lines
179179 .read_raw = tmp006_read_raw,
180180 .write_raw = tmp006_write_raw,
181181 .attrs = &tmp006_attribute_group,
182− .driver_module = THIS_MODULE,
183182 };
184183
185184 static bool tmp006_check_identification(struct i2c_client *client)
drivers/iio/temperature/tmp007.c+0−1
@@ -426,7 +426,6 @@ static const struct iio_info tmp007_info = { · 425 unmodified lines
426426 .read_event_value = tmp007_read_thresh,
427427 .write_event_value = tmp007_write_thresh,
428428 .attrs = &tmp007_attribute_group,
429− .driver_module = THIS_MODULE,
430429 };
431430
432431 static bool tmp007_identify(struct i2c_client *client)
drivers/iio/temperature/tsys01.c+0−1
@@ -111,7 +111,6 @@ static const struct iio_chan_spec tsys01_channels[] = { · 110 unmodified lines
111111
112112 static const struct iio_info tsys01_info = {
113113 .read_raw = tsys01_read_raw,
114− .driver_module = THIS_MODULE,
115114 };
116115
117116 static bool tsys01_crc_valid(u16 *n_prom)
drivers/iio/temperature/tsys02d.c+0−1
@@ -120,7 +120,6 @@ static const struct iio_info tsys02d_info = { · 119 unmodified lines
120120 .read_raw = tsys02d_read_raw,
121121 .write_raw = tsys02d_write_raw,
122122 .attrs = &tsys02d_attribute_group,
123− .driver_module = THIS_MODULE,
124123 };
125124
126125 static int tsys02d_probe(struct i2c_client *client,
drivers/iio/trigger/iio-trig-hrtimer.c+0−1
@@ -114,7 +114,6 @@ static int iio_trig_hrtimer_set_state(struct iio_trigger *trig, bool state) · 113 unmodified lines
114114 }
115115
116116 static const struct iio_trigger_ops iio_hrtimer_trigger_ops = {
117− .owner = THIS_MODULE,
118117 .set_trigger_state = iio_trig_hrtimer_set_state,
119118 };
120119
drivers/iio/trigger/iio-trig-interrupt.c+0−1
@@ -29,7 +29,6 @@ static irqreturn_t iio_interrupt_trigger_poll(int irq, void *private) · 28 unmodified lines
2929 }
3030
3131 static const struct iio_trigger_ops iio_interrupt_trigger_ops = {
32− .owner = THIS_MODULE,
3332 };
3433
3534 static int iio_interrupt_trigger_probe(struct platform_device *pdev)
drivers/iio/trigger/iio-trig-loop.c+0−1
@@ -74,7 +74,6 @@ static int iio_loop_trigger_set_state(struct iio_trigger *trig, bool state) · 73 unmodified lines
7474
7575 static const struct iio_trigger_ops iio_loop_trigger_ops = {
7676 .set_trigger_state = iio_loop_trigger_set_state,
77− .owner = THIS_MODULE,
7877 };
7978
8079 static struct iio_sw_trigger *iio_trig_loop_probe(const char *name)
drivers/iio/trigger/iio-trig-sysfs.c+0−1
@@ -127,7 +127,6 @@ static const struct attribute_group *iio_sysfs_trigger_attr_groups[] = { · 126 unmodified lines
127127 };
128128
129129 static const struct iio_trigger_ops iio_sysfs_trigger_ops = {
130− .owner = THIS_MODULE,
131130 };
132131
133132 static int iio_sysfs_trigger_probe(int id)
drivers/iio/trigger/stm32-lptimer-trigger.c+0−1
@@ -37,7 +37,6 @@ static int stm32_lptim_validate_device(struct iio_trigger *trig, · 36 unmodified lines
3737 }
3838
3939 static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
40− .owner = THIS_MODULE,
4140 .validate_device = stm32_lptim_validate_device,
4241 };
4342
drivers/iio/trigger/stm32-timer-trigger.c+0−2
@@ -355,7 +355,6 @@ static const struct attribute_group *stm32_trigger_attr_groups[] = { · 354 unmodified lines
355355 };
356356
357357 static const struct iio_trigger_ops timer_trigger_ops = {
358− .owner = THIS_MODULE,
359358 };
360359
361360 static int stm32_setup_iio_triggers(struct stm32_timer_trigger *priv)
@@ -493,7 +492,6 @@ static int stm32_counter_validate_trigger(struct iio_dev *indio_dev, · 131 unmodified lines
493492 }
494493
495494 static const struct iio_info stm32_trigger_info = {
496− .driver_module = THIS_MODULE,
497495 .validate_trigger = stm32_counter_validate_trigger,
498496 .read_raw = stm32_counter_read_raw,
499497 .write_raw = stm32_counter_write_raw
drivers/input/touchscreen/tsc2007_iio.c+0−1
@@ -104,7 +104,6 @@ static int tsc2007_read_raw(struct iio_dev *indio_dev, · 103 unmodified lines
104104
105105 static const struct iio_info tsc2007_iio_info = {
106106 .read_raw = tsc2007_read_raw,
107− .driver_module = THIS_MODULE,
108107 };
109108
110109 int tsc2007_iio_configure(struct tsc2007 *ts)
drivers/misc/Kconfig+0−10
@@ -393,16 +393,6 @@ config SPEAR13XX_PCIE_GADGET · 392 unmodified lines
393393 entry will be created for that controller. User can use these
394394 sysfs node to configure PCIe EP as per his requirements.
395395
396−config TI_DAC7512
397− tristate "Texas Instruments DAC7512"
398− depends on SPI && SYSFS
399− help
400− If you say yes here you get support for the Texas Instruments
401− DAC7512 16-bit digital-to-analog converter.
402−
403− This driver can also be built as a module. If so, the module
404− will be called ti_dac7512.
405−
406396 config VMWARE_BALLOON
407397 tristate "VMware Balloon Driver"
408398 depends on VMWARE_VMCI && X86 && HYPERVISOR_GUEST
drivers/misc/Makefile+0−1
@@ -31,7 +31,6 @@ obj-$(CONFIG_ISL29003) += isl29003.o · 30 unmodified lines
3131 obj-$(CONFIG_ISL29020) += isl29020.o
3232 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
3333 obj-$(CONFIG_DS1682) += ds1682.o
34−obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o
3534 obj-$(CONFIG_C2PORT) += c2port/
3635 obj-$(CONFIG_HMC6352) += hmc6352.o
3736 obj-y += eeprom/
drivers/misc/ti_dac7512.c+0−103
@@ -1,103 +0,0 @@
1−/*
2− * dac7512.c - Linux kernel module for
3− * Texas Instruments DAC7512
4− *
5− * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; either version 2 of the License, or
10− * (at your option) any later version.
11− *
12− * This program is distributed in the hope that it will be useful,
13− * but WITHOUT ANY WARRANTY; without even the implied warranty of
14− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15− * GNU General Public License for more details.
16− *
17− * You should have received a copy of the GNU General Public License
18− * along with this program; if not, write to the Free Software
19− * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20− */
21−
22−#include <linux/module.h>
23−#include <linux/spi/spi.h>
24−#include <linux/of.h>
25−
26−static ssize_t dac7512_store_val(struct device *dev,
27− struct device_attribute *attr,
28− const char *buf, size_t count)
29−{
30− struct spi_device *spi = to_spi_device(dev);
31− unsigned char tmp[2];
32− unsigned long val;
33− int ret;
34−
35− ret = kstrtoul(buf, 10, &val);
36− if (ret)
37− return ret;
38−
39− tmp[0] = val >> 8;
40− tmp[1] = val & 0xff;
41− spi_write(spi, tmp, sizeof(tmp));
42− return count;
43−}
44−
45−static DEVICE_ATTR(value, S_IWUSR, NULL, dac7512_store_val);
46−
47−static struct attribute *dac7512_attributes[] = {
48− &dev_attr_value.attr,
49− NULL
50−};
51−
52−static const struct attribute_group dac7512_attr_group = {
53− .attrs = dac7512_attributes,
54−};
55−
56−static int dac7512_probe(struct spi_device *spi)
57−{
58− int ret;
59−
60− spi->bits_per_word = 8;
61− spi->mode = SPI_MODE_0;
62− ret = spi_setup(spi);
63− if (ret < 0)
64− return ret;
65−
66− return sysfs_create_group(&spi->dev.kobj, &dac7512_attr_group);
67−}
68−
69−static int dac7512_remove(struct spi_device *spi)
70−{
71− sysfs_remove_group(&spi->dev.kobj, &dac7512_attr_group);
72− return 0;
73−}
74−
75−static const struct spi_device_id dac7512_id_table[] = {
76− { "dac7512", 0 },
77− { }
78−};
79−MODULE_DEVICE_TABLE(spi, dac7512_id_table);
80−
81−#ifdef CONFIG_OF
82−static const struct of_device_id dac7512_of_match[] = {
83− { .compatible = "ti,dac7512", },
84− { }
85−};
86−MODULE_DEVICE_TABLE(of, dac7512_of_match);
87−#endif
88−
89−static struct spi_driver dac7512_driver = {
90− .driver = {
91− .name = "dac7512",
92− .of_match_table = of_match_ptr(dac7512_of_match),
93− },
94− .probe = dac7512_probe,
95− .remove = dac7512_remove,
96− .id_table = dac7512_id_table,
97−};
98−
99−module_spi_driver(dac7512_driver);
100−
101−MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
102−MODULE_DESCRIPTION("DAC7512 16-bit DAC");
103−MODULE_LICENSE("GPL v2");
drivers/platform/x86/toshiba_acpi.c+0−1
@@ -2510,7 +2510,6 @@ static const struct iio_chan_spec toshiba_iio_accel_channels[] = { · 2509 unmodified lines
25102510 };
25112511
25122512 static const struct iio_info toshiba_iio_accel_info = {
2513− .driver_module = THIS_MODULE,
25142513 .read_raw = &toshiba_iio_accel_read_raw,
25152514 };
25162515
drivers/staging/android/TODO+0−1
@@ -1,5 +1,4 @@
11 TODO:
2− - checkpatch.pl cleanups
32 - sparse fixes
43 - rename files to be not so "generic"
54 - add proper arch dependencies as needed
drivers/staging/android/ion/ion-ioctl.c+5−6
@@ -27,19 +27,18 @@ union ion_ioctl_arg { · 26 unmodified lines
2727
2828 static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
2929 {
30− int ret = 0;
31−
3230 switch (cmd) {
3331 case ION_IOC_HEAP_QUERY:
34− ret = arg->query.reserved0 != 0;
35− ret |= arg->query.reserved1 != 0;
36− ret |= arg->query.reserved2 != 0;
32+ if (arg->query.reserved0 ||
33+ arg->query.reserved1 ||
34+ arg->query.reserved2)
35+ return -EINVAL;
3736 break;
3837 default:
3938 break;
4039 }
4140
42− return ret ? -EINVAL : 0;
41+ return 0;
4342 }
4443
4544 /* fix up the cases where the ioctl direction bits are incorrect */
drivers/staging/android/ion/ion.c+0−2
@@ -81,7 +81,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, · 80 unmodified lines
8181 unsigned long flags)
8282 {
8383 struct ion_buffer *buffer;
84− struct sg_table *table;
8584 int ret;
8685
8786 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
@@ -109,7 +108,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, · 21 unmodified lines
109108 goto err1;
110109 }
111110
112− table = buffer->sg_table;
113111 buffer->dev = dev;
114112 buffer->size = len;
115113
drivers/staging/android/ion/ion.h+1−1
@@ -86,6 +86,7 @@ struct ion_buffer { · 85 unmodified lines
8686 struct sg_table *sg_table;
8787 struct list_head attachments;
8888 };
89+
8990 void ion_buffer_destroy(struct ion_buffer *buffer);
9091
9192 /**
@@ -299,7 +300,6 @@ size_t ion_heap_freelist_shrink(struct ion_heap *heap, · 207 unmodified lines
299300 */
300301 size_t ion_heap_freelist_size(struct ion_heap *heap);
301302
302−
303303 /**
304304 * functions for creating and destroying a heap pool -- allows you
305305 * to keep a pool of pre allocated memory to use from your heap. Keeping
drivers/staging/ccree/cc_hal.h+0−33
@@ -1,33 +0,0 @@
1−/*
2− * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License version 2 as
6− * published by the Free Software Foundation.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program; if not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−/* pseudo cc_hal.h for cc7x_perf_test_driver (to be able to include code from
18− * CC drivers).
19− */
20−
21−#ifndef __CC_HAL_H__
22−#define __CC_HAL_H__
23−
24−#include <linux/io.h>
25−
26−#define READ_REGISTER(_addr) ioread32((_addr))
27−#define WRITE_REGISTER(_addr, _data) iowrite32((_data), (_addr))
28−
29−#define CC_HAL_WRITE_REGISTER(offset, val) \
30− WRITE_REGISTER(cc_base + (offset), val)
31−#define CC_HAL_READ_REGISTER(offset) READ_REGISTER(cc_base + (offset))
32−
33−#endif
drivers/staging/ccree/cc_lli_defs.h+1−1
@@ -59,7 +59,7 @@ static inline void cc_lli_set_addr(u32 *lli_p, dma_addr_t addr) · 58 unmodified lines
5959 lli_p[LLI_WORD0_OFFSET] = (addr & U32_MAX);
6060 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
6161 lli_p[LLI_WORD1_OFFSET] &= ~LLI_HADDR_MASK;
62− lli_p[LLI_WORD1_OFFSET] |= FIELD_PREP(LLI_HADDR_MASK, (addr >> 16));
62+ lli_p[LLI_WORD1_OFFSET] |= FIELD_PREP(LLI_HADDR_MASK, (addr >> 32));
6363 #endif /* CONFIG_ARCH_DMA_ADDR_T_64BIT */
6464 }
6565
drivers/staging/ccree/cc_regs.h+0−42
@@ -1,42 +0,0 @@
1−/*
2− * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License version 2 as
6− * published by the Free Software Foundation.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program; if not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−/*!
18− * @file
19− * @brief This file contains macro definitions for accessing ARM TrustZone
20− * CryptoCell register space.
21− */
22−
23−#ifndef _CC_REGS_H_
24−#define _CC_REGS_H_
25−
26−#include <linux/bitfield.h>
27−
28−#define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP)
29−#define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \
30− DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \
31− DX_AXIM_MON_COMP_VALUE_BIT_SHIFT)
32−
33−#define AXIM_MON_BASE_OFFSET CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_COMP)
34−#define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \
35− DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \
36− DX_AXIM_MON_COMP_VALUE_BIT_SHIFT)
37−
38−/* Register Offset macro */
39−#define CC_REG_OFFSET(unit_name, reg_name) \
40− (DX_BASE_ ## unit_name + DX_ ## reg_name ## _REG_OFFSET)
41−
42−#endif /*_CC_REGS_H_*/
drivers/staging/ccree/dx_reg_base_host.h+0−25
@@ -1,25 +0,0 @@
1−/*
2− * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License version 2 as
6− * published by the Free Software Foundation.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program; if not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef __DX_REG_BASE_HOST_H__
18−#define __DX_REG_BASE_HOST_H__
19−
20−#define DX_BASE_CC 0x80000000
21−#define DX_BASE_HOST_RGF 0x0UL
22−#define DX_BASE_CRY_KERNEL 0x0UL
23−#define DX_BASE_ROM 0x40000000
24−
25−#endif /*__DX_REG_BASE_HOST_H__*/
drivers/staging/ccree/ssi_aead.c+144−114
@@ -92,18 +92,17 @@ static inline bool valid_assoclen(struct aead_request *req) · 91 unmodified lines
9292
9393 static void ssi_aead_exit(struct crypto_aead *tfm)
9494 {
95− struct device *dev = NULL;
9695 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
96+ struct device *dev = drvdata_to_dev(ctx->drvdata);
9797
98− SSI_LOG_DEBUG("Clearing context @%p for %s\n",
99− crypto_aead_ctx(tfm), crypto_tfm_alg_name(&tfm->base));
98+ dev_dbg(dev, "Clearing context @%p for %s\n", crypto_aead_ctx(tfm),
99+ crypto_tfm_alg_name(&tfm->base));
100100
101− dev = &ctx->drvdata->plat_dev->dev;
102101 /* Unmap enckey buffer */
103102 if (ctx->enckey) {
104103 dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, ctx->enckey_dma_addr);
105− SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=%pad\n",
106− ctx->enckey_dma_addr);
104+ dev_dbg(dev, "Freed enckey DMA buffer enckey_dma_addr=%pad\n",
105+ &ctx->enckey_dma_addr);
107106 ctx->enckey_dma_addr = 0;
108107 ctx->enckey = NULL;
109108 }
@@ -116,8 +115,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm) · 6 unmodified lines
116115 xcbc->xcbc_keys,
117116 xcbc->xcbc_keys_dma_addr);
118117 }
119− SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer xcbc_keys_dma_addr=%pad\n",
120− xcbc->xcbc_keys_dma_addr);
118+ dev_dbg(dev, "Freed xcbc_keys DMA buffer xcbc_keys_dma_addr=%pad\n",
119+ &xcbc->xcbc_keys_dma_addr);
121120 xcbc->xcbc_keys_dma_addr = 0;
122121 xcbc->xcbc_keys = NULL;
123122 } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
@@ -127,8 +126,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm) · 3 unmodified lines
127126 dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE,
128127 hmac->ipad_opad,
129128 hmac->ipad_opad_dma_addr);
130− SSI_LOG_DEBUG("Freed ipad_opad DMA buffer ipad_opad_dma_addr=%pad\n",
131− hmac->ipad_opad_dma_addr);
129+ dev_dbg(dev, "Freed ipad_opad DMA buffer ipad_opad_dma_addr=%pad\n",
130+ &hmac->ipad_opad_dma_addr);
132131 hmac->ipad_opad_dma_addr = 0;
133132 hmac->ipad_opad = NULL;
134133 }
@@ -136,8 +135,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm) · 1 unmodified line
136135 dma_free_coherent(dev, MAX_HMAC_BLOCK_SIZE,
137136 hmac->padded_authkey,
138137 hmac->padded_authkey_dma_addr);
139− SSI_LOG_DEBUG("Freed padded_authkey DMA buffer padded_authkey_dma_addr=%pad\n",
140− hmac->padded_authkey_dma_addr);
138+ dev_dbg(dev, "Freed padded_authkey DMA buffer padded_authkey_dma_addr=%pad\n",
139+ &hmac->padded_authkey_dma_addr);
141140 hmac->padded_authkey_dma_addr = 0;
142141 hmac->padded_authkey = NULL;
143142 }
@@ -146,29 +145,31 @@ static void ssi_aead_exit(struct crypto_aead *tfm) · 2 unmodified lines
146145
147146 static int ssi_aead_init(struct crypto_aead *tfm)
148147 {
149− struct device *dev;
150148 struct aead_alg *alg = crypto_aead_alg(tfm);
151149 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
152150 struct ssi_crypto_alg *ssi_alg =
153151 container_of(alg, struct ssi_crypto_alg, aead_alg);
154− SSI_LOG_DEBUG("Initializing context @%p for %s\n", ctx, crypto_tfm_alg_name(&tfm->base));
152+ struct device *dev = drvdata_to_dev(ssi_alg->drvdata);
153+
154+ dev_dbg(dev, "Initializing context @%p for %s\n", ctx,
155+ crypto_tfm_alg_name(&tfm->base));
155156
156157 /* Initialize modes in instance */
157158 ctx->cipher_mode = ssi_alg->cipher_mode;
158159 ctx->flow_mode = ssi_alg->flow_mode;
159160 ctx->auth_mode = ssi_alg->auth_mode;
160161 ctx->drvdata = ssi_alg->drvdata;
161− dev = &ctx->drvdata->plat_dev->dev;
162162 crypto_aead_set_reqsize(tfm, sizeof(struct aead_req_ctx));
163163
164164 /* Allocate key buffer, cache line aligned */
165165 ctx->enckey = dma_alloc_coherent(dev, AES_MAX_KEY_SIZE,
166166 &ctx->enckey_dma_addr, GFP_KERNEL);
167167 if (!ctx->enckey) {
168− SSI_LOG_ERR("Failed allocating key buffer\n");
168+ dev_err(dev, "Failed allocating key buffer\n");
169169 goto init_failed;
170170 }
171− SSI_LOG_DEBUG("Allocated enckey buffer in context ctx->enckey=@%p\n", ctx->enckey);
171+ dev_dbg(dev, "Allocated enckey buffer in context ctx->enckey=@%p\n",
172+ ctx->enckey);
172173
173174 /* Set default authlen value */
174175
@@ -182,7 +183,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) · 7 unmodified lines
182183 &xcbc->xcbc_keys_dma_addr,
183184 GFP_KERNEL);
184185 if (!xcbc->xcbc_keys) {
185− SSI_LOG_ERR("Failed allocating buffer for XCBC keys\n");
186+ dev_err(dev, "Failed allocating buffer for XCBC keys\n");
186187 goto init_failed;
187188 }
188189 } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC authentication */
@@ -196,12 +197,12 @@ static int ssi_aead_init(struct crypto_aead *tfm) · 7 unmodified lines
196197 GFP_KERNEL);
197198
198199 if (!hmac->ipad_opad) {
199− SSI_LOG_ERR("Failed allocating IPAD/OPAD buffer\n");
200+ dev_err(dev, "Failed allocating IPAD/OPAD buffer\n");
200201 goto init_failed;
201202 }
202203
203− SSI_LOG_DEBUG("Allocated authkey buffer in context ctx->authkey=@%p\n",
204− hmac->ipad_opad);
204+ dev_dbg(dev, "Allocated authkey buffer in context ctx->authkey=@%p\n",
205+ hmac->ipad_opad);
205206
206207 hmac->padded_authkey = dma_alloc_coherent(dev,
207208 MAX_HMAC_BLOCK_SIZE,
@@ -209,7 +210,7 @@ static int ssi_aead_init(struct crypto_aead *tfm) · 1 unmodified line
209210 GFP_KERNEL);
210211
211212 if (!hmac->padded_authkey) {
212− SSI_LOG_ERR("failed to allocate padded_authkey\n");
213+ dev_err(dev, "failed to allocate padded_authkey\n");
213214 goto init_failed;
214215 }
215216 } else {
@@ -240,8 +241,7 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c · 24 unmodified lines
240241 if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
241242 if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr,
242243 ctx->authsize) != 0) {
243− SSI_LOG_DEBUG("Payload authentication failure, "
244− "(auth-size=%d, cipher=%d).\n",
244+ dev_dbg(dev, "Payload authentication failure, (auth-size=%d, cipher=%d)\n",
245245 ctx->authsize, ctx->cipher_mode);
246246 /* In case of payload authentication failure, MUST NOT
247247 * revealed the decrypted message --> zero its memory.
@@ -252,8 +252,11 @@ static void ssi_aead_complete(struct device *dev, void *ssi_req, void __iomem *c · 4 unmodified lines
252252 } else { /*ENCRYPT*/
253253 if (unlikely(areq_ctx->is_icv_fragmented))
254254 ssi_buffer_mgr_copy_scatterlist_portion(
255− areq_ctx->mac_buf, areq_ctx->dst_sgl, areq->cryptlen + areq_ctx->dst_offset,
256− areq->cryptlen + areq_ctx->dst_offset + ctx->authsize, SSI_SG_FROM_BUF);
255+ dev, areq_ctx->mac_buf, areq_ctx->dst_sgl,
256+ areq->cryptlen + areq_ctx->dst_offset,
257+ (areq->cryptlen + areq_ctx->dst_offset +
258+ ctx->authsize),
259+ SSI_SG_FROM_BUF);
257260
258261 /* If an IV was generated, copy it back to the user provided buffer. */
259262 if (areq_ctx->backup_giv) {
@@ -377,8 +380,10 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx) · 117 unmodified lines
377380
378381 static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
379382 {
380− SSI_LOG_DEBUG("enc_keylen=%u authkeylen=%u\n",
381− ctx->enc_keylen, ctx->auth_keylen);
383+ struct device *dev = drvdata_to_dev(ctx->drvdata);
384+
385+ dev_dbg(dev, "enc_keylen=%u authkeylen=%u\n",
386+ ctx->enc_keylen, ctx->auth_keylen);
382387
383388 switch (ctx->auth_mode) {
384389 case DRV_HASH_SHA1:
@@ -395,22 +400,22 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx) · 10 unmodified lines
395400 return -EINVAL;
396401 break;
397402 default:
398− SSI_LOG_ERR("Invalid auth_mode=%d\n", ctx->auth_mode);
403+ dev_err(dev, "Invalid auth_mode=%d\n", ctx->auth_mode);
399404 return -EINVAL;
400405 }
401406 /* Check cipher key size */
402407 if (unlikely(ctx->flow_mode == S_DIN_to_DES)) {
403408 if (ctx->enc_keylen != DES3_EDE_KEY_SIZE) {
404− SSI_LOG_ERR("Invalid cipher(3DES) key size: %u\n",
405− ctx->enc_keylen);
409+ dev_err(dev, "Invalid cipher(3DES) key size: %u\n",
410+ ctx->enc_keylen);
406411 return -EINVAL;
407412 }
408413 } else { /* Default assumed to be AES ciphers */
409414 if ((ctx->enc_keylen != AES_KEYSIZE_128) &&
410415 (ctx->enc_keylen != AES_KEYSIZE_192) &&
411416 (ctx->enc_keylen != AES_KEYSIZE_256)) {
412− SSI_LOG_ERR("Invalid cipher(AES) key size: %u\n",
413− ctx->enc_keylen);
417+ dev_err(dev, "Invalid cipher(AES) key size: %u\n",
418+ ctx->enc_keylen);
414419 return -EINVAL;
415420 }
416421 }
@@ -426,7 +431,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl · 9 unmodified lines
426431 {
427432 dma_addr_t key_dma_addr = 0;
428433 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
429− struct device *dev = &ctx->drvdata->plat_dev->dev;
434+ struct device *dev = drvdata_to_dev(ctx->drvdata);
430435 u32 larval_addr = ssi_ahash_get_larval_digest_sram_addr(
431436 ctx->drvdata, ctx->auth_mode);
432437 struct ssi_crypto_req ssi_req = {};
@@ -455,8 +460,8 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl · 22 unmodified lines
455460 if (likely(keylen != 0)) {
456461 key_dma_addr = dma_map_single(dev, (void *)key, keylen, DMA_TO_DEVICE);
457462 if (unlikely(dma_mapping_error(dev, key_dma_addr))) {
458− SSI_LOG_ERR("Mapping key va=0x%p len=%u for"
459− " DMA failed\n", key, keylen);
463+ dev_err(dev, "Mapping key va=0x%p len=%u for DMA failed\n",
464+ key, keylen);
460465 return -ENOMEM;
461466 }
462467 if (keylen > blocksize) {
@@ -534,7 +539,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int keyl · 71 unmodified lines
534539
535540 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
536541 if (unlikely(rc != 0))
537− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
542+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
538543
539544 if (likely(key_dma_addr != 0))
540545 dma_unmap_single(dev, key_dma_addr, keylen, DMA_TO_DEVICE);
@@ -551,10 +556,10 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) · 10 unmodified lines
551556 struct crypto_authenc_key_param *param;
552557 struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ];
553558 int seq_len = 0, rc = -EINVAL;
559+ struct device *dev = drvdata_to_dev(ctx->drvdata);
554560
555− SSI_LOG_DEBUG("Setting key in context @%p for %s. key=%p keylen=%u\n",
556− ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)),
557− key, keylen);
561+ dev_dbg(dev, "Setting key in context @%p for %s. key=%p keylen=%u\n",
562+ ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen);
558563
559564 /* STAT_PHASE_0: Init and sanity checks */
560565
@@ -622,7 +627,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) · 61 unmodified lines
622627 case DRV_HASH_NULL: /* non-authenc modes, e.g., CCM */
623628 break; /* No auth. key setup */
624629 default:
625− SSI_LOG_ERR("Unsupported authenc (%d)\n", ctx->auth_mode);
630+ dev_err(dev, "Unsupported authenc (%d)\n", ctx->auth_mode);
626631 rc = -ENOTSUPP;
627632 goto badkey;
628633 }
@@ -632,7 +637,7 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) · 3 unmodified lines
632637 if (seq_len > 0) { /* For CCM there is no sequence to setup the key */
633638 rc = send_request(ctx->drvdata, &ssi_req, desc, seq_len, 0);
634639 if (unlikely(rc != 0)) {
635− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
640+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
636641 goto setkey_error;
637642 }
638643 }
@@ -651,7 +656,6 @@ setkey_error: · 12 unmodified lines
651656 static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen)
652657 {
653658 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
654− int rc = 0;
655659
656660 if (keylen < 3)
657661 return -EINVAL;
@@ -659,9 +663,7 @@ static int ssi_rfc4309_ccm_setkey(struct crypto_aead *tfm, const u8 *key, unsign · 1 unmodified line
659663 keylen -= 3;
660664 memcpy(ctx->ctr_nonce, key + keylen, 3);
661665
662− rc = ssi_aead_setkey(tfm, key, keylen);
663−
664− return rc;
666+ return ssi_aead_setkey(tfm, key, keylen);
665667 }
666668 #endif /*SSI_CC_HAS_AES_CCM*/
667669
@@ -670,6 +672,7 @@ static int ssi_aead_setauthsize( · 2 unmodified lines
670672 unsigned int authsize)
671673 {
672674 struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc);
675+ struct device *dev = drvdata_to_dev(ctx->drvdata);
673676
674677 /* Unsupported auth. sizes */
675678 if ((authsize == 0) ||
@@ -678,7 +681,7 @@ static int ssi_aead_setauthsize( · 2 unmodified lines
678681 }
679682
680683 ctx->authsize = authsize;
681− SSI_LOG_DEBUG("authlen=%d\n", ctx->authsize);
684+ dev_dbg(dev, "authlen=%d\n", ctx->authsize);
682685
683686 return 0;
684687 }
@@ -731,10 +734,11 @@ ssi_aead_create_assoc_desc( · 46 unmodified lines
731734 struct aead_req_ctx *areq_ctx = aead_request_ctx(areq);
732735 enum ssi_req_dma_buf_type assoc_dma_type = areq_ctx->assoc_buff_type;
733736 unsigned int idx = *seq_size;
737+ struct device *dev = drvdata_to_dev(ctx->drvdata);
734738
735739 switch (assoc_dma_type) {
736740 case SSI_DMA_BUF_DLLI:
737− SSI_LOG_DEBUG("ASSOC buffer type DLLI\n");
741+ dev_dbg(dev, "ASSOC buffer type DLLI\n");
738742 hw_desc_init(&desc[idx]);
739743 set_din_type(&desc[idx], DMA_DLLI, sg_dma_address(areq->src),
740744 areq->assoclen, NS_BIT); set_flow_mode(&desc[idx],
@@ -744,7 +748,7 @@ ssi_aead_create_assoc_desc( · 3 unmodified lines
744748 set_din_not_last_indication(&desc[idx]);
745749 break;
746750 case SSI_DMA_BUF_MLLI:
747− SSI_LOG_DEBUG("ASSOC buffer type MLLI\n");
751+ dev_dbg(dev, "ASSOC buffer type MLLI\n");
748752 hw_desc_init(&desc[idx]);
749753 set_din_type(&desc[idx], DMA_MLLI, areq_ctx->assoc.sram_addr,
750754 areq_ctx->assoc.mlli_nents, NS_BIT);
@@ -755,7 +759,7 @@ ssi_aead_create_assoc_desc( · 4 unmodified lines
755759 break;
756760 case SSI_DMA_BUF_NULL:
757761 default:
758− SSI_LOG_ERR("Invalid ASSOC buffer type\n");
762+ dev_err(dev, "Invalid ASSOC buffer type\n");
759763 }
760764
761765 *seq_size = (++idx);
@@ -772,6 +776,9 @@ ssi_aead_process_authenc_data_desc( · 10 unmodified lines
772776 struct aead_req_ctx *areq_ctx = aead_request_ctx(areq);
773777 enum ssi_req_dma_buf_type data_dma_type = areq_ctx->data_buff_type;
774778 unsigned int idx = *seq_size;
779+ struct crypto_aead *tfm = crypto_aead_reqtfm(areq);
780+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
781+ struct device *dev = drvdata_to_dev(ctx->drvdata);
775782
776783 switch (data_dma_type) {
777784 case SSI_DMA_BUF_DLLI:
@@ -783,7 +790,7 @@ ssi_aead_process_authenc_data_desc( · 5 unmodified lines
783790 unsigned int offset =
784791 (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
785792 areq_ctx->dst_offset : areq_ctx->src_offset;
786− SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type DLLI\n");
793+ dev_dbg(dev, "AUTHENC: SRC/DST buffer type DLLI\n");
787794 hw_desc_init(&desc[idx]);
788795 set_din_type(&desc[idx], DMA_DLLI,
789796 (sg_dma_address(cipher) + offset),
@@ -810,7 +817,7 @@ ssi_aead_process_authenc_data_desc( · 20 unmodified lines
810817 }
811818 }
812819
813− SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type MLLI\n");
820+ dev_dbg(dev, "AUTHENC: SRC/DST buffer type MLLI\n");
814821 hw_desc_init(&desc[idx]);
815822 set_din_type(&desc[idx], DMA_MLLI, mlli_addr, mlli_nents,
816823 NS_BIT);
@@ -819,7 +826,7 @@ ssi_aead_process_authenc_data_desc( · 2 unmodified lines
819826 }
820827 case SSI_DMA_BUF_NULL:
821828 default:
822− SSI_LOG_ERR("AUTHENC: Invalid SRC/DST buffer type\n");
829+ dev_err(dev, "AUTHENC: Invalid SRC/DST buffer type\n");
823830 }
824831
825832 *seq_size = (++idx);
@@ -835,13 +842,16 @@ ssi_aead_process_cipher_data_desc( · 9 unmodified lines
835842 unsigned int idx = *seq_size;
836843 struct aead_req_ctx *areq_ctx = aead_request_ctx(areq);
837844 enum ssi_req_dma_buf_type data_dma_type = areq_ctx->data_buff_type;
845+ struct crypto_aead *tfm = crypto_aead_reqtfm(areq);
846+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
847+ struct device *dev = drvdata_to_dev(ctx->drvdata);
838848
839849 if (areq_ctx->cryptlen == 0)
840850 return; /*null processing*/
841851
842852 switch (data_dma_type) {
843853 case SSI_DMA_BUF_DLLI:
844− SSI_LOG_DEBUG("CIPHER: SRC/DST buffer type DLLI\n");
854+ dev_dbg(dev, "CIPHER: SRC/DST buffer type DLLI\n");
845855 hw_desc_init(&desc[idx]);
846856 set_din_type(&desc[idx], DMA_DLLI,
847857 (sg_dma_address(areq_ctx->src_sgl) +
@@ -853,7 +863,7 @@ ssi_aead_process_cipher_data_desc( · 5 unmodified lines
853863 set_flow_mode(&desc[idx], flow_mode);
854864 break;
855865 case SSI_DMA_BUF_MLLI:
856− SSI_LOG_DEBUG("CIPHER: SRC/DST buffer type MLLI\n");
866+ dev_dbg(dev, "CIPHER: SRC/DST buffer type MLLI\n");
857867 hw_desc_init(&desc[idx]);
858868 set_din_type(&desc[idx], DMA_MLLI, areq_ctx->src.sram_addr,
859869 areq_ctx->src.mlli_nents, NS_BIT);
@@ -863,7 +873,7 @@ ssi_aead_process_cipher_data_desc( · 3 unmodified lines
863873 break;
864874 case SSI_DMA_BUF_NULL:
865875 default:
866− SSI_LOG_ERR("CIPHER: Invalid SRC/DST buffer type\n");
876+ dev_err(dev, "CIPHER: Invalid SRC/DST buffer type\n");
867877 }
868878
869879 *seq_size = (++idx);
@@ -1178,14 +1188,15 @@ static inline void ssi_aead_load_mlli_to_sram( · 308 unmodified lines
11781188 struct aead_req_ctx *req_ctx = aead_request_ctx(req);
11791189 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
11801190 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
1191+ struct device *dev = drvdata_to_dev(ctx->drvdata);
11811192
11821193 if (unlikely(
11831194 (req_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) ||
11841195 (req_ctx->data_buff_type == SSI_DMA_BUF_MLLI) ||
11851196 !req_ctx->is_single_pass)) {
1186− SSI_LOG_DEBUG("Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n",
1187− (unsigned int)ctx->drvdata->mlli_sram_addr,
1188− req_ctx->mlli_params.mlli_len);
1197+ dev_dbg(dev, "Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n",
1198+ (unsigned int)ctx->drvdata->mlli_sram_addr,
1199+ req_ctx->mlli_params.mlli_len);
11891200 /* Copy MLLI table host-to-sram */
11901201 hw_desc_init(&desc[*seq_size]);
11911202 set_din_type(&desc[*seq_size], DMA_DLLI,
@@ -1333,6 +1344,7 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, · 141 unmodified lines
13331344 struct aead_request *req)
13341345 {
13351346 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
1347+ struct device *dev = drvdata_to_dev(ctx->drvdata);
13361348 unsigned int assoclen = req->assoclen;
13371349 unsigned int cipherlen = (direct == DRV_CRYPTO_DIRECTION_DECRYPT) ?
13381350 (req->cryptlen - ctx->authsize) : req->cryptlen;
@@ -1371,7 +1383,7 @@ static int validate_data_size(struct ssi_aead_ctx *ctx, · 32 unmodified lines
13711383 areq_ctx->is_single_pass = false;
13721384 break;
13731385 default:
1374− SSI_LOG_ERR("Unexpected flow mode (%d)\n", ctx->flow_mode);
1386+ dev_err(dev, "Unexpected flow mode (%d)\n", ctx->flow_mode);
13751387 goto data_size_err;
13761388 }
13771389
@@ -1554,6 +1566,7 @@ static int config_ccm_adata(struct aead_request *req) · 176 unmodified lines
15541566 {
15551567 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
15561568 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
1569+ struct device *dev = drvdata_to_dev(ctx->drvdata);
15571570 struct aead_req_ctx *req_ctx = aead_request_ctx(req);
15581571 //unsigned int size_of_a = 0, rem_a_size = 0;
15591572 unsigned int lp = req->iv[0];
@@ -1575,7 +1588,7 @@ static int config_ccm_adata(struct aead_request *req) · 15 unmodified lines
15751588 /* taken from crypto/ccm.c */
15761589 /* 2 <= L <= 8, so 1 <= L' <= 7. */
15771590 if (l < 2 || l > 8) {
1578− SSI_LOG_ERR("illegal iv value %X\n", req->iv[0]);
1591+ dev_err(dev, "illegal iv value %X\n", req->iv[0]);
15791592 return -EINVAL;
15801593 }
15811594 memcpy(b0, req->iv, AES_BLOCK_SIZE);
@@ -1588,8 +1601,10 @@ static int config_ccm_adata(struct aead_request *req) · 6 unmodified lines
15881601 *b0 |= 64; /* Enable bit 6 if Adata exists. */
15891602
15901603 rc = set_msg_len(b0 + 16 - l, cryptlen, l); /* Write L'. */
1591− if (rc != 0)
1604+ if (rc != 0) {
1605+ dev_err(dev, "message len overflow detected");
15921606 return rc;
1607+ }
15931608 /* END of "taken from crypto/ccm.c" */
15941609
15951610 /* l(a) - size of associated data. */
@@ -1812,7 +1827,6 @@ static inline int ssi_aead_gcm( · 216 unmodified lines
18121827 unsigned int *seq_size)
18131828 {
18141829 struct aead_req_ctx *req_ctx = aead_request_ctx(req);
1815− unsigned int idx = *seq_size;
18161830 unsigned int cipher_flow_mode;
18171831
18181832 if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
@@ -1829,7 +1843,6 @@ static inline int ssi_aead_gcm( · 10 unmodified lines
18291843 ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size);
18301844 ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size);
18311845 ssi_aead_process_gcm_result_desc(req, desc, seq_size);
1832− idx = *seq_size;
18331846 return 0;
18341847 }
18351848
@@ -1844,7 +1857,6 @@ static inline int ssi_aead_gcm( · 8 unmodified lines
18441857 ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, seq_size);
18451858 ssi_aead_process_gcm_result_desc(req, desc, seq_size);
18461859
1847− idx = *seq_size;
18481860 return 0;
18491861 }
18501862
@@ -1861,13 +1873,13 @@ static inline void ssi_aead_dump_gcm( · 10 unmodified lines
18611873 return;
18621874
18631875 if (title) {
1864− SSI_LOG_DEBUG("----------------------------------------------------------------------------------");
1865− SSI_LOG_DEBUG("%s\n", title);
1876+ dev_dbg(dev, "----------------------------------------------------------------------------------");
1877+ dev_dbg(dev, "%s\n", title);
18661878 }
18671879
1868− SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d\n",
1869− ctx->cipher_mode, ctx->authsize, ctx->enc_keylen,
1870− req->assoclen, req_ctx->cryptlen);
1880+ dev_dbg(dev, "cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, cryptlen %d\n",
1881+ ctx->cipher_mode, ctx->authsize, ctx->enc_keylen,
1882+ req->assoclen, req_ctx->cryptlen);
18711883
18721884 if (ctx->enckey)
18731885 dump_byte_array("mac key", ctx->enckey, 16);
@@ -1897,6 +1909,7 @@ static int config_gcm_context(struct aead_request *req) · 23 unmodified lines
18971909 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
18981910 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
18991911 struct aead_req_ctx *req_ctx = aead_request_ctx(req);
1912+ struct device *dev = drvdata_to_dev(ctx->drvdata);
19001913
19011914 unsigned int cryptlen = (req_ctx->gen_ctx.op_type ==
19021915 DRV_CRYPTO_DIRECTION_ENCRYPT) ?
@@ -1904,7 +1917,8 @@ static int config_gcm_context(struct aead_request *req) · 1 unmodified line
19041917 (req->cryptlen - ctx->authsize);
19051918 __be32 counter = cpu_to_be32(2);
19061919
1907− SSI_LOG_DEBUG("%s() cryptlen = %d, req->assoclen = %d ctx->authsize = %d\n", __func__, cryptlen, req->assoclen, ctx->authsize);
1920+ dev_dbg(dev, "%s() cryptlen = %d, req->assoclen = %d ctx->authsize = %d\n",
1921+ __func__, cryptlen, req->assoclen, ctx->authsize);
19081922
19091923 memset(req_ctx->hkey, 0, AES_BLOCK_SIZE);
19101924
@@ -1958,20 +1972,20 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 47 unmodified lines
19581972 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
19591973 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
19601974 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
1961− struct device *dev = &ctx->drvdata->plat_dev->dev;
1975+ struct device *dev = drvdata_to_dev(ctx->drvdata);
19621976 struct ssi_crypto_req ssi_req = {};
19631977
1964− SSI_LOG_DEBUG("%s context=%p req=%p iv=%p src=%p src_ofs=%d dst=%p dst_ofs=%d cryptolen=%d\n",
1965− ((direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Encrypt" : "Decrypt"),
1966− ctx, req, req->iv, sg_virt(req->src), req->src->offset,
1967− sg_virt(req->dst), req->dst->offset, req->cryptlen);
1978+ dev_dbg(dev, "%s context=%p req=%p iv=%p src=%p src_ofs=%d dst=%p dst_ofs=%d cryptolen=%d\n",
1979+ ((direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Enc" : "Dec"),
1980+ ctx, req, req->iv, sg_virt(req->src), req->src->offset,
1981+ sg_virt(req->dst), req->dst->offset, req->cryptlen);
19681982
19691983 /* STAT_PHASE_0: Init and sanity checks */
19701984
19711985 /* Check data length according to mode */
19721986 if (unlikely(validate_data_size(ctx, direct, req) != 0)) {
1973− SSI_LOG_ERR("Unsupported crypt/assoc len %d/%d.\n",
1974− req->cryptlen, req->assoclen);
1987+ dev_err(dev, "Unsupported crypt/assoc len %d/%d.\n",
1988+ req->cryptlen, req->assoclen);
19751989 crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN);
19761990 return -EINVAL;
19771991 }
@@ -2017,7 +2031,8 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 39 unmodified lines
20172031 if (ctx->cipher_mode == DRV_CIPHER_CCM) {
20182032 rc = config_ccm_adata(req);
20192033 if (unlikely(rc != 0)) {
2020− SSI_LOG_ERR("config_ccm_adata() returned with a failure %d!", rc);
2034+ dev_dbg(dev, "config_ccm_adata() returned with a failure %d!",
2035+ rc);
20212036 goto exit;
20222037 }
20232038 } else {
@@ -2031,7 +2046,8 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 7 unmodified lines
20312046 if (ctx->cipher_mode == DRV_CIPHER_GCTR) {
20322047 rc = config_gcm_context(req);
20332048 if (unlikely(rc != 0)) {
2034− SSI_LOG_ERR("config_gcm_context() returned with a failure %d!", rc);
2049+ dev_dbg(dev, "config_gcm_context() returned with a failure %d!",
2050+ rc);
20352051 goto exit;
20362052 }
20372053 }
@@ -2039,7 +2055,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 1 unmodified line
20392055
20402056 rc = ssi_buffer_mgr_map_aead_request(ctx->drvdata, req);
20412057 if (unlikely(rc != 0)) {
2042− SSI_LOG_ERR("map_request() failed\n");
2058+ dev_err(dev, "map_request() failed\n");
20432059 goto exit;
20442060 }
20452061
@@ -2095,7 +2111,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 49 unmodified lines
20952111 break;
20962112 #endif
20972113 default:
2098− SSI_LOG_ERR("Unsupported authenc (%d)\n", ctx->auth_mode);
2114+ dev_err(dev, "Unsupported authenc (%d)\n", ctx->auth_mode);
20992115 ssi_buffer_mgr_unmap_aead_request(dev, req);
21002116 rc = -ENOTSUPP;
21012117 goto exit;
@@ -2106,7 +2122,7 @@ static int ssi_aead_process(struct aead_request *req, enum drv_crypto_direction · 4 unmodified lines
21062122 rc = send_request(ctx->drvdata, &ssi_req, desc, seq_len, 1);
21072123
21082124 if (unlikely(rc != -EINPROGRESS)) {
2109− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
2125+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
21102126 ssi_buffer_mgr_unmap_aead_request(dev, req);
21112127 }
21122128
@@ -2139,10 +2155,13 @@ static int ssi_rfc4309_ccm_encrypt(struct aead_request *req) · 26 unmodified lines
21392155 /* Very similar to ssi_aead_encrypt() above. */
21402156
21412157 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
2158+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
2159+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2160+ struct device *dev = drvdata_to_dev(ctx->drvdata);
21422161 int rc = -EINVAL;
21432162
21442163 if (!valid_assoclen(req)) {
2145− SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen);
2164+ dev_err(dev, "invalid Assoclen:%u\n", req->assoclen);
21462165 goto out;
21472166 }
21482167
@@ -2183,13 +2202,14 @@ static int ssi_aead_decrypt(struct aead_request *req) · 34 unmodified lines
21832202 #if SSI_CC_HAS_AES_CCM
21842203 static int ssi_rfc4309_ccm_decrypt(struct aead_request *req)
21852204 {
2186− /* Very similar to ssi_aead_decrypt() above. */
2187−
2205+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
2206+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2207+ struct device *dev = drvdata_to_dev(ctx->drvdata);
21882208 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
21892209 int rc = -EINVAL;
21902210
21912211 if (!valid_assoclen(req)) {
2192− SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen);
2212+ dev_err(dev, "invalid Assoclen:%u\n", req->assoclen);
21932213 goto out;
21942214 }
21952215
@@ -2214,9 +2234,9 @@ out: · 18 unmodified lines
22142234 static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen)
22152235 {
22162236 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2217− int rc = 0;
2237+ struct device *dev = drvdata_to_dev(ctx->drvdata);
22182238
2219− SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key);
2239+ dev_dbg(dev, "%s() keylen %d, key %p\n", __func__, keylen, key);
22202240
22212241 if (keylen < 4)
22222242 return -EINVAL;
@@ -2224,17 +2244,15 @@ static int ssi_rfc4106_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign · 1 unmodified line
22242244 keylen -= 4;
22252245 memcpy(ctx->ctr_nonce, key + keylen, 4);
22262246
2227− rc = ssi_aead_setkey(tfm, key, keylen);
2228−
2229− return rc;
2247+ return ssi_aead_setkey(tfm, key, keylen);
22302248 }
22312249
22322250 static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int keylen)
22332251 {
22342252 struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2235− int rc = 0;
2253+ struct device *dev = drvdata_to_dev(ctx->drvdata);
22362254
2237− SSI_LOG_DEBUG("%s() keylen %d, key %p\n", __func__, keylen, key);
2255+ dev_dbg(dev, "%s() keylen %d, key %p\n", __func__, keylen, key);
22382256
22392257 if (keylen < 4)
22402258 return -EINVAL;
@@ -2242,9 +2260,7 @@ static int ssi_rfc4543_gcm_setkey(struct crypto_aead *tfm, const u8 *key, unsign · 1 unmodified line
22422260 keylen -= 4;
22432261 memcpy(ctx->ctr_nonce, key + keylen, 4);
22442262
2245− rc = ssi_aead_setkey(tfm, key, keylen);
2246−
2247− return rc;
2263+ return ssi_aead_setkey(tfm, key, keylen);
22482264 }
22492265
22502266 static int ssi_gcm_setauthsize(struct crypto_aead *authenc,
@@ -2269,7 +2285,10 @@ static int ssi_gcm_setauthsize(struct crypto_aead *authenc, · 18 unmodified lines
22692285 static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc,
22702286 unsigned int authsize)
22712287 {
2272− SSI_LOG_DEBUG("authsize %d\n", authsize);
2288+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc);
2289+ struct device *dev = drvdata_to_dev(ctx->drvdata);
2290+
2291+ dev_dbg(dev, "authsize %d\n", authsize);
22732292
22742293 switch (authsize) {
22752294 case 8:
@@ -2286,7 +2305,10 @@ static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc, · 10 unmodified lines
22862305 static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc,
22872306 unsigned int authsize)
22882307 {
2289− SSI_LOG_DEBUG("authsize %d\n", authsize);
2308+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(authenc);
2309+ struct device *dev = drvdata_to_dev(ctx->drvdata);
2310+
2311+ dev_dbg(dev, "authsize %d\n", authsize);
22902312
22912313 if (authsize != 16)
22922314 return -EINVAL;
@@ -2298,11 +2320,14 @@ static int ssi_rfc4106_gcm_encrypt(struct aead_request *req) · 5 unmodified lines
22982320 {
22992321 /* Very similar to ssi_aead_encrypt() above. */
23002322
2323+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
2324+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2325+ struct device *dev = drvdata_to_dev(ctx->drvdata);
23012326 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
23022327 int rc = -EINVAL;
23032328
23042329 if (!valid_assoclen(req)) {
2305− SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen);
2330+ dev_err(dev, "invalid Assoclen:%u\n", req->assoclen);
23062331 goto out;
23072332 }
23082333
@@ -2350,11 +2375,14 @@ static int ssi_rfc4106_gcm_decrypt(struct aead_request *req) · 41 unmodified lines
23502375 {
23512376 /* Very similar to ssi_aead_decrypt() above. */
23522377
2378+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
2379+ struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
2380+ struct device *dev = drvdata_to_dev(ctx->drvdata);
23532381 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
23542382 int rc = -EINVAL;
23552383
23562384 if (!valid_assoclen(req)) {
2357− SSI_LOG_ERR("invalid Assoclen:%u\n", req->assoclen);
2385+ dev_err(dev, "invalid Assoclen:%u\n", req->assoclen);
23582386 goto out;
23592387 }
23602388
@@ -2654,16 +2682,17 @@ static struct ssi_alg_template aead_algs[] = { · 293 unmodified lines
26542682 #endif /*SSI_CC_HAS_AES_GCM*/
26552683 };
26562684
2657−static struct ssi_crypto_alg *ssi_aead_create_alg(struct ssi_alg_template *template)
2685+static struct ssi_crypto_alg *ssi_aead_create_alg(
2686+ struct ssi_alg_template *template,
2687+ struct device *dev)
26582688 {
26592689 struct ssi_crypto_alg *t_alg;
26602690 struct aead_alg *alg;
26612691
26622692 t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL);
2663− if (!t_alg) {
2664− SSI_LOG_ERR("failed to allocate t_alg\n");
2693+ if (!t_alg)
26652694 return ERR_PTR(-ENOMEM);
2666− }
2695+
26672696 alg = &template->template_aead;
26682697
26692698 snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", template->name);
@@ -2713,6 +2742,7 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata) · 43 unmodified lines
27132742 struct ssi_crypto_alg *t_alg;
27142743 int rc = -ENOMEM;
27152744 int alg;
2745+ struct device *dev = drvdata_to_dev(drvdata);
27162746
27172747 aead_handle = kmalloc(sizeof(*aead_handle), GFP_KERNEL);
27182748 if (!aead_handle) {
@@ -2720,36 +2750,36 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata) · 1 unmodified line
27202750 goto fail0;
27212751 }
27222752
2753+ INIT_LIST_HEAD(&aead_handle->aead_list);
27232754 drvdata->aead_handle = aead_handle;
27242755
27252756 aead_handle->sram_workspace_addr = ssi_sram_mgr_alloc(
27262757 drvdata, MAX_HMAC_DIGEST_SIZE);
27272758 if (aead_handle->sram_workspace_addr == NULL_SRAM_ADDR) {
2728− SSI_LOG_ERR("SRAM pool exhausted\n");
2759+ dev_err(dev, "SRAM pool exhausted\n");
27292760 rc = -ENOMEM;
27302761 goto fail1;
27312762 }
27322763
2733− INIT_LIST_HEAD(&aead_handle->aead_list);
2734−
27352764 /* Linux crypto */
27362765 for (alg = 0; alg < ARRAY_SIZE(aead_algs); alg++) {
2737− t_alg = ssi_aead_create_alg(&aead_algs[alg]);
2766+ t_alg = ssi_aead_create_alg(&aead_algs[alg], dev);
27382767 if (IS_ERR(t_alg)) {
27392768 rc = PTR_ERR(t_alg);
2740− SSI_LOG_ERR("%s alg allocation failed\n",
2741− aead_algs[alg].driver_name);
2769+ dev_err(dev, "%s alg allocation failed\n",
2770+ aead_algs[alg].driver_name);
27422771 goto fail1;
27432772 }
27442773 t_alg->drvdata = drvdata;
27452774 rc = crypto_register_aead(&t_alg->aead_alg);
27462775 if (unlikely(rc != 0)) {
2747− SSI_LOG_ERR("%s alg registration failed\n",
2748− t_alg->aead_alg.base.cra_driver_name);
2776+ dev_err(dev, "%s alg registration failed\n",
2777+ t_alg->aead_alg.base.cra_driver_name);
27492778 goto fail2;
27502779 } else {
27512780 list_add_tail(&t_alg->entry, &aead_handle->aead_list);
2752− SSI_LOG_DEBUG("Registered %s\n", t_alg->aead_alg.base.cra_driver_name);
2781+ dev_dbg(dev, "Registered %s\n",
2782+ t_alg->aead_alg.base.cra_driver_name);
27532783 }
27542784 }
27552785
drivers/staging/ccree/ssi_buffer_mgr.c+208−230
@@ -33,14 +33,10 @@ · 32 unmodified lines
3333 #include "ssi_hash.h"
3434 #include "ssi_aead.h"
3535
36−#ifdef CC_DEBUG
3736 #define GET_DMA_BUFFER_TYPE(buff_type) ( \
3837 ((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \
3938 ((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \
4039 ((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID")
41−#else
42−#define GET_DMA_BUFFER_TYPE(buff_type)
43−#endif
4440
4541 enum dma_buffer_type {
4642 DMA_NULL_TYPE = -1,
@@ -76,16 +72,12 @@ struct buffer_array { · 29 unmodified lines
7672 * @lbytes: [OUT] Returns the amount of bytes at the last entry
7773 */
7874 static unsigned int ssi_buffer_mgr_get_sgl_nents(
79− struct scatterlist *sg_list, unsigned int nbytes, u32 *lbytes, bool *is_chained)
75+ struct device *dev, struct scatterlist *sg_list,
76+ unsigned int nbytes, u32 *lbytes, bool *is_chained)
8077 {
8178 unsigned int nents = 0;
8279
8380 while (nbytes != 0) {
84− if (sg_is_chain(sg_list)) {
85− SSI_LOG_ERR("Unexpected chained entry "
86− "in sg (entry =0x%X)\n", nents);
87− BUG();
88− }
8981 if (sg_list->length != 0) {
9082 nents++;
9183 /* get the number of bytes in the last entry */
@@ -98,7 +90,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents( · 6 unmodified lines
9890 *is_chained = true;
9991 }
10092 }
101− SSI_LOG_DEBUG("nents %d last bytes %d\n", nents, *lbytes);
93+ dev_dbg(dev, "nents %d last bytes %d\n", nents, *lbytes);
10294 return nents;
10395 }
10496
@@ -134,20 +126,20 @@ void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len) · 29 unmodified lines
134126 * @direct:
135127 */
136128 void ssi_buffer_mgr_copy_scatterlist_portion(
137− u8 *dest, struct scatterlist *sg,
138− u32 to_skip, u32 end,
139− enum ssi_sg_cpy_direct direct)
129+ struct device *dev, u8 *dest,
130+ struct scatterlist *sg, u32 to_skip,
131+ u32 end, enum ssi_sg_cpy_direct direct)
140132 {
141133 u32 nents, lbytes;
142134
143− nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL);
135+ nents = ssi_buffer_mgr_get_sgl_nents(dev, sg, end, &lbytes, NULL);
144136 sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip + 1), to_skip,
145137 (direct == SSI_SG_TO_BUF));
146138 }
147139
148140 static inline int ssi_buffer_mgr_render_buff_to_mlli(
149− dma_addr_t buff_dma, u32 buff_size, u32 *curr_nents,
150− u32 **mlli_entry_pp)
141+ struct device *dev, dma_addr_t buff_dma, u32 buff_size,
142+ u32 *curr_nents, u32 **mlli_entry_pp)
151143 {
152144 u32 *mlli_entry_p = *mlli_entry_pp;
153145 u32 new_nents;
@@ -161,9 +153,9 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( · 7 unmodified lines
161153 while (buff_size > CC_MAX_MLLI_ENTRY_SIZE) {
162154 cc_lli_set_addr(mlli_entry_p, buff_dma);
163155 cc_lli_set_size(mlli_entry_p, CC_MAX_MLLI_ENTRY_SIZE);
164− SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n", *curr_nents,
165− mlli_entry_p[LLI_WORD0_OFFSET],
166− mlli_entry_p[LLI_WORD1_OFFSET]);
156+ dev_dbg(dev, "entry[%d]: single_buff=0x%08X size=%08X\n",
157+ *curr_nents, mlli_entry_p[LLI_WORD0_OFFSET],
158+ mlli_entry_p[LLI_WORD1_OFFSET]);
167159 buff_dma += CC_MAX_MLLI_ENTRY_SIZE;
168160 buff_size -= CC_MAX_MLLI_ENTRY_SIZE;
169161 mlli_entry_p = mlli_entry_p + 2;
@@ -172,9 +164,9 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( · 2 unmodified lines
172164 /*Last entry */
173165 cc_lli_set_addr(mlli_entry_p, buff_dma);
174166 cc_lli_set_size(mlli_entry_p, buff_size);
175− SSI_LOG_DEBUG("entry[%d]: single_buff=0x%08X size=%08X\n", *curr_nents,
176− mlli_entry_p[LLI_WORD0_OFFSET],
177− mlli_entry_p[LLI_WORD1_OFFSET]);
167+ dev_dbg(dev, "entry[%d]: single_buff=0x%08X size=%08X\n",
168+ *curr_nents, mlli_entry_p[LLI_WORD0_OFFSET],
169+ mlli_entry_p[LLI_WORD1_OFFSET]);
178170 mlli_entry_p = mlli_entry_p + 2;
179171 *mlli_entry_pp = mlli_entry_p;
180172 (*curr_nents)++;
@@ -182,8 +174,9 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli( · 1 unmodified line
182174 }
183175
184176 static inline int ssi_buffer_mgr_render_scatterlist_to_mlli(
185− struct scatterlist *sgl, u32 sgl_data_len, u32 sgl_offset,
186− u32 *curr_nents, u32 **mlli_entry_pp)
177+ struct device *dev, struct scatterlist *sgl,
178+ u32 sgl_data_len, u32 sgl_offset, u32 *curr_nents,
179+ u32 **mlli_entry_pp)
187180 {
188181 struct scatterlist *curr_sgl = sgl;
189182 u32 *mlli_entry_p = *mlli_entry_pp;
@@ -197,8 +190,8 @@ static inline int ssi_buffer_mgr_render_scatterlist_to_mlli( · 7 unmodified lines
197190 sgl_data_len;
198191 sgl_data_len -= entry_data_len;
199192 rc = ssi_buffer_mgr_render_buff_to_mlli(
200− sg_dma_address(curr_sgl) + sgl_offset, entry_data_len,
201− curr_nents, &mlli_entry_p);
193+ dev, sg_dma_address(curr_sgl) + sgl_offset,
194+ entry_data_len, curr_nents, &mlli_entry_p);
202195 if (rc != 0)
203196 return rc;
204197
@@ -217,14 +210,14 @@ static int ssi_buffer_mgr_generate_mlli( · 12 unmodified lines
217210 u32 total_nents = 0, prev_total_nents = 0;
218211 int rc = 0, i;
219212
220− SSI_LOG_DEBUG("NUM of SG's = %d\n", sg_data->num_of_buffers);
213+ dev_dbg(dev, "NUM of SG's = %d\n", sg_data->num_of_buffers);
221214
222215 /* Allocate memory from the pointed pool */
223216 mlli_params->mlli_virt_addr = dma_pool_alloc(
224217 mlli_params->curr_pool, GFP_KERNEL,
225218 &mlli_params->mlli_dma_addr);
226219 if (unlikely(!mlli_params->mlli_virt_addr)) {
227− SSI_LOG_ERR("dma_pool_alloc() failed\n");
220+ dev_err(dev, "dma_pool_alloc() failed\n");
228221 rc = -ENOMEM;
229222 goto build_mlli_exit;
230223 }
@@ -234,12 +227,12 @@ static int ssi_buffer_mgr_generate_mlli( · 3 unmodified lines
234227 for (i = 0; i < sg_data->num_of_buffers; i++) {
235228 if (sg_data->type[i] == DMA_SGL_TYPE)
236229 rc = ssi_buffer_mgr_render_scatterlist_to_mlli(
237− sg_data->entry[i].sgl,
238− sg_data->total_data_len[i], sg_data->offset[i], &total_nents,
239− &mlli_p);
230+ dev, sg_data->entry[i].sgl,
231+ sg_data->total_data_len[i], sg_data->offset[i],
232+ &total_nents, &mlli_p);
240233 else /*DMA_BUFF_TYPE*/
241234 rc = ssi_buffer_mgr_render_buff_to_mlli(
242− sg_data->entry[i].buffer_dma,
235+ dev, sg_data->entry[i].buffer_dma,
243236 sg_data->total_data_len[i], &total_nents,
244237 &mlli_p);
245238 if (rc != 0)
@@ -259,26 +252,23 @@ static int ssi_buffer_mgr_generate_mlli( · 13 unmodified lines
259252 /* Set MLLI size for the bypass operation */
260253 mlli_params->mlli_len = (total_nents * LLI_ENTRY_BYTE_SIZE);
261254
262− SSI_LOG_DEBUG("MLLI params: "
263− "virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
264− mlli_params->mlli_virt_addr,
265− mlli_params->mlli_dma_addr,
266− mlli_params->mlli_len);
255+ dev_dbg(dev, "MLLI params: virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
256+ mlli_params->mlli_virt_addr, &mlli_params->mlli_dma_addr,
257+ mlli_params->mlli_len);
267258
268259 build_mlli_exit:
269260 return rc;
270261 }
271262
272263 static inline void ssi_buffer_mgr_add_buffer_entry(
273− struct buffer_array *sgl_data,
264+ struct device *dev, struct buffer_array *sgl_data,
274265 dma_addr_t buffer_dma, unsigned int buffer_len,
275266 bool is_last_entry, u32 *mlli_nents)
276267 {
277268 unsigned int index = sgl_data->num_of_buffers;
278269
279− SSI_LOG_DEBUG("index=%u single_buff=%pad "
280− "buffer_len=0x%08X is_last=%d\n",
281− index, buffer_dma, buffer_len, is_last_entry);
270+ dev_dbg(dev, "index=%u single_buff=%pad buffer_len=0x%08X is_last=%d\n",
271+ index, &buffer_dma, buffer_len, is_last_entry);
282272 sgl_data->nents[index] = 1;
283273 sgl_data->entry[index].buffer_dma = buffer_dma;
284274 sgl_data->offset[index] = 0;
@@ -292,6 +282,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry( · 7 unmodified lines
292282 }
293283
294284 static inline void ssi_buffer_mgr_add_scatterlist_entry(
285+ struct device *dev,
295286 struct buffer_array *sgl_data,
296287 unsigned int nents,
297288 struct scatterlist *sgl,
@@ -302,8 +293,8 @@ static inline void ssi_buffer_mgr_add_scatterlist_entry( · 4 unmodified lines
302293 {
303294 unsigned int index = sgl_data->num_of_buffers;
304295
305− SSI_LOG_DEBUG("index=%u nents=%u sgl=%pK data_len=0x%08X is_last=%d\n",
306− index, nents, sgl, data_len, is_last_table);
296+ dev_dbg(dev, "index=%u nents=%u sgl=%pK data_len=0x%08X is_last=%d\n",
297+ index, nents, sgl, data_len, is_last_table);
307298 sgl_data->nents[index] = nents;
308299 sgl_data->entry[index].sgl = sgl;
309300 sgl_data->offset[index] = data_offset;
@@ -327,7 +318,7 @@ ssi_buffer_mgr_dma_map_sg(struct device *dev, struct scatterlist *sg, u32 nents, · 17 unmodified lines
327318 if (!l_sg)
328319 break;
329320 if (unlikely(dma_map_sg(dev, l_sg, 1, direction) != 1)) {
330− SSI_LOG_ERR("dma_map_page() sg buffer failed\n");
321+ dev_err(dev, "dma_map_page() sg buffer failed\n");
331322 goto err;
332323 }
333324 l_sg = sg_next(l_sg);
@@ -356,26 +347,22 @@ static int ssi_buffer_mgr_map_scatterlist( · 22 unmodified lines
356347 if (sg_is_last(sg)) {
357348 /* One entry only case -set to DLLI */
358349 if (unlikely(dma_map_sg(dev, sg, 1, direction) != 1)) {
359− SSI_LOG_ERR("dma_map_sg() single buffer failed\n");
350+ dev_err(dev, "dma_map_sg() single buffer failed\n");
360351 return -ENOMEM;
361352 }
362− SSI_LOG_DEBUG("Mapped sg: dma_address=%pad "
363− "page=%p addr=%pK offset=%u "
364− "length=%u\n",
365− sg_dma_address(sg),
366− sg_page(sg),
367− sg_virt(sg),
368− sg->offset, sg->length);
353+ dev_dbg(dev, "Mapped sg: dma_address=%pad page=%p addr=%pK offset=%u length=%u\n",
354+ &sg_dma_address(sg), sg_page(sg), sg_virt(sg),
355+ sg->offset, sg->length);
369356 *lbytes = nbytes;
370357 *nents = 1;
371358 *mapped_nents = 1;
372359 } else { /*sg_is_last*/
373− *nents = ssi_buffer_mgr_get_sgl_nents(sg, nbytes, lbytes,
360+ *nents = ssi_buffer_mgr_get_sgl_nents(dev, sg, nbytes, lbytes,
374361 &is_chained);
375362 if (*nents > max_sg_nents) {
376363 *nents = 0;
377− SSI_LOG_ERR("Too many fragments. current %d max %d\n",
378− *nents, max_sg_nents);
364+ dev_err(dev, "Too many fragments. current %d max %d\n",
365+ *nents, max_sg_nents);
379366 return -ENOMEM;
380367 }
381368 if (!is_chained) {
@@ -385,7 +372,7 @@ static int ssi_buffer_mgr_map_scatterlist( · 3 unmodified lines
385372 *mapped_nents = dma_map_sg(dev, sg, *nents, direction);
386373 if (unlikely(*mapped_nents == 0)) {
387374 *nents = 0;
388− SSI_LOG_ERR("dma_map_sg() sg buffer failed\n");
375+ dev_err(dev, "dma_map_sg() sg buffer failed\n");
389376 return -ENOMEM;
390377 }
391378 } else {
@@ -398,7 +385,7 @@ static int ssi_buffer_mgr_map_scatterlist( · 6 unmodified lines
398385 direction);
399386 if (unlikely(*mapped_nents != *nents)) {
400387 *nents = *mapped_nents;
401− SSI_LOG_ERR("dma_map_sg() sg buffer failed\n");
388+ dev_err(dev, "dma_map_sg() sg buffer failed\n");
402389 return -ENOMEM;
403390 }
404391 }
@@ -414,26 +401,22 @@ ssi_aead_handle_config_buf(struct device *dev, · 9 unmodified lines
414401 struct buffer_array *sg_data,
415402 unsigned int assoclen)
416403 {
417− SSI_LOG_DEBUG(" handle additional data config set to DLLI\n");
404+ dev_dbg(dev, " handle additional data config set to DLLI\n");
418405 /* create sg for the current buffer */
419406 sg_init_one(&areq_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size);
420407 if (unlikely(dma_map_sg(dev, &areq_ctx->ccm_adata_sg, 1,
421408 DMA_TO_DEVICE) != 1)) {
422− SSI_LOG_ERR("dma_map_sg() "
423− "config buffer failed\n");
424− return -ENOMEM;
409+ dev_err(dev, "dma_map_sg() config buffer failed\n");
410+ return -ENOMEM;
425411 }
426− SSI_LOG_DEBUG("Mapped curr_buff: dma_address=%pad "
427− "page=%p addr=%pK "
428− "offset=%u length=%u\n",
429− sg_dma_address(&areq_ctx->ccm_adata_sg),
430− sg_page(&areq_ctx->ccm_adata_sg),
431− sg_virt(&areq_ctx->ccm_adata_sg),
432− areq_ctx->ccm_adata_sg.offset,
433− areq_ctx->ccm_adata_sg.length);
412+ dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK offset=%u length=%u\n",
413+ &sg_dma_address(&areq_ctx->ccm_adata_sg),
414+ sg_page(&areq_ctx->ccm_adata_sg),
415+ sg_virt(&areq_ctx->ccm_adata_sg),
416+ areq_ctx->ccm_adata_sg.offset, areq_ctx->ccm_adata_sg.length);
434417 /* prepare for case of MLLI */
435418 if (assoclen > 0) {
436− ssi_buffer_mgr_add_scatterlist_entry(sg_data, 1,
419+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data, 1,
437420 &areq_ctx->ccm_adata_sg,
438421 (AES_BLOCK_SIZE + areq_ctx->ccm_hdr_size),
439422 0, false, NULL);
@@ -447,28 +430,23 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, · 7 unmodified lines
447430 u32 curr_buff_cnt,
448431 struct buffer_array *sg_data)
449432 {
450− SSI_LOG_DEBUG(" handle curr buff %x set to DLLI\n", curr_buff_cnt);
433+ dev_dbg(dev, " handle curr buff %x set to DLLI\n", curr_buff_cnt);
451434 /* create sg for the current buffer */
452435 sg_init_one(areq_ctx->buff_sg, curr_buff, curr_buff_cnt);
453436 if (unlikely(dma_map_sg(dev, areq_ctx->buff_sg, 1,
454437 DMA_TO_DEVICE) != 1)) {
455− SSI_LOG_ERR("dma_map_sg() "
456− "src buffer failed\n");
457− return -ENOMEM;
438+ dev_err(dev, "dma_map_sg() src buffer failed\n");
439+ return -ENOMEM;
458440 }
459− SSI_LOG_DEBUG("Mapped curr_buff: dma_address=%pad "
460− "page=%p addr=%pK "
461− "offset=%u length=%u\n",
462− sg_dma_address(areq_ctx->buff_sg),
463− sg_page(areq_ctx->buff_sg),
464− sg_virt(areq_ctx->buff_sg),
465− areq_ctx->buff_sg->offset,
466− areq_ctx->buff_sg->length);
441+ dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK offset=%u length=%u\n",
442+ &sg_dma_address(areq_ctx->buff_sg), sg_page(areq_ctx->buff_sg),
443+ sg_virt(areq_ctx->buff_sg), areq_ctx->buff_sg->offset,
444+ areq_ctx->buff_sg->length);
467445 areq_ctx->data_dma_buf_type = SSI_DMA_BUF_DLLI;
468446 areq_ctx->curr_sg = areq_ctx->buff_sg;
469447 areq_ctx->in_nents = 0;
470448 /* prepare for case of MLLI */
471− ssi_buffer_mgr_add_scatterlist_entry(sg_data, 1, areq_ctx->buff_sg,
449+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data, 1, areq_ctx->buff_sg,
472450 curr_buff_cnt, 0, false, NULL);
473451 return 0;
474452 }
@@ -483,9 +461,8 @@ void ssi_buffer_mgr_unmap_blkcipher_request( · 8 unmodified lines
483461 struct blkcipher_req_ctx *req_ctx = (struct blkcipher_req_ctx *)ctx;
484462
485463 if (likely(req_ctx->gen_ctx.iv_dma_addr != 0)) {
486− SSI_LOG_DEBUG("Unmapped iv: iv_dma_addr=%pad iv_size=%u\n",
487− req_ctx->gen_ctx.iv_dma_addr,
488− ivsize);
464+ dev_dbg(dev, "Unmapped iv: iv_dma_addr=%pad iv_size=%u\n",
465+ &req_ctx->gen_ctx.iv_dma_addr, ivsize);
489466 dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr,
490467 ivsize,
491468 req_ctx->is_giv ? DMA_BIDIRECTIONAL :
@@ -499,11 +476,11 @@ void ssi_buffer_mgr_unmap_blkcipher_request( · 7 unmodified lines
499476 }
500477
501478 dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL);
502− SSI_LOG_DEBUG("Unmapped req->src=%pK\n", sg_virt(src));
479+ dev_dbg(dev, "Unmapped req->src=%pK\n", sg_virt(src));
503480
504481 if (src != dst) {
505482 dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_BIDIRECTIONAL);
506− SSI_LOG_DEBUG("Unmapped req->dst=%pK\n", sg_virt(dst));
483+ dev_dbg(dev, "Unmapped req->dst=%pK\n", sg_virt(dst));
507484 }
508485 }
509486
@@ -519,7 +496,7 @@ int ssi_buffer_mgr_map_blkcipher_request( · 9 unmodified lines
519496 struct blkcipher_req_ctx *req_ctx = (struct blkcipher_req_ctx *)ctx;
520497 struct mlli_params *mlli_params = &req_ctx->mlli_params;
521498 struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle;
522− struct device *dev = &drvdata->plat_dev->dev;
499+ struct device *dev = drvdata_to_dev(drvdata);
523500 struct buffer_array sg_data;
524501 u32 dummy = 0;
525502 int rc = 0;
@@ -539,13 +516,12 @@ int ssi_buffer_mgr_map_blkcipher_request( · 13 unmodified lines
539516 DMA_TO_DEVICE);
540517 if (unlikely(dma_mapping_error(dev,
541518 req_ctx->gen_ctx.iv_dma_addr))) {
542− SSI_LOG_ERR("Mapping iv %u B at va=%pK "
543− "for DMA failed\n", ivsize, info);
519+ dev_err(dev, "Mapping iv %u B at va=%pK for DMA failed\n",
520+ ivsize, info);
544521 return -ENOMEM;
545522 }
546− SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=%pad\n",
547− ivsize, info,
548− req_ctx->gen_ctx.iv_dma_addr);
523+ dev_dbg(dev, "Mapped iv %u B at va=%pK to dma=%pad\n",
524+ ivsize, info, &req_ctx->gen_ctx.iv_dma_addr);
549525 } else {
550526 req_ctx->gen_ctx.iv_dma_addr = 0;
551527 }
@@ -567,7 +543,7 @@ int ssi_buffer_mgr_map_blkcipher_request( · 15 unmodified lines
567543 /* Handle inplace operation */
568544 if (unlikely(req_ctx->dma_buf_type == SSI_DMA_BUF_MLLI)) {
569545 req_ctx->out_nents = 0;
570− ssi_buffer_mgr_add_scatterlist_entry(&sg_data,
546+ ssi_buffer_mgr_add_scatterlist_entry(dev, &sg_data,
571547 req_ctx->in_nents,
572548 src, nbytes, 0,
573549 true,
@@ -587,12 +563,12 @@ int ssi_buffer_mgr_map_blkcipher_request( · 13 unmodified lines
587563 req_ctx->dma_buf_type = SSI_DMA_BUF_MLLI;
588564
589565 if (unlikely((req_ctx->dma_buf_type == SSI_DMA_BUF_MLLI))) {
590− ssi_buffer_mgr_add_scatterlist_entry(&sg_data,
566+ ssi_buffer_mgr_add_scatterlist_entry(dev, &sg_data,
591567 req_ctx->in_nents,
592568 src, nbytes, 0,
593569 true,
594570 &req_ctx->in_mlli_nents);
595− ssi_buffer_mgr_add_scatterlist_entry(&sg_data,
571+ ssi_buffer_mgr_add_scatterlist_entry(dev, &sg_data,
596572 req_ctx->out_nents,
597573 dst, nbytes, 0,
598574 true,
@@ -607,8 +583,8 @@ int ssi_buffer_mgr_map_blkcipher_request( · 8 unmodified lines
607583 goto ablkcipher_exit;
608584 }
609585
610− SSI_LOG_DEBUG("areq_ctx->dma_buf_type = %s\n",
611− GET_DMA_BUFFER_TYPE(req_ctx->dma_buf_type));
586+ dev_dbg(dev, "areq_ctx->dma_buf_type = %s\n",
587+ GET_DMA_BUFFER_TYPE(req_ctx->dma_buf_type));
612588
613589 return 0;
614590
@@ -674,30 +650,34 @@ void ssi_buffer_mgr_unmap_aead_request( · 59 unmodified lines
674650 *allocated and should be released
675651 */
676652 if (areq_ctx->mlli_params.curr_pool) {
677− SSI_LOG_DEBUG("free MLLI buffer: dma=%pad virt=%pK\n",
678− areq_ctx->mlli_params.mlli_dma_addr,
679− areq_ctx->mlli_params.mlli_virt_addr);
653+ dev_dbg(dev, "free MLLI buffer: dma=%pad virt=%pK\n",
654+ &areq_ctx->mlli_params.mlli_dma_addr,
655+ areq_ctx->mlli_params.mlli_virt_addr);
680656 dma_pool_free(areq_ctx->mlli_params.curr_pool,
681657 areq_ctx->mlli_params.mlli_virt_addr,
682658 areq_ctx->mlli_params.mlli_dma_addr);
683659 }
684660
685− SSI_LOG_DEBUG("Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n", sg_virt(req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, req->assoclen, req->cryptlen);
661+ dev_dbg(dev, "Unmapping src sgl: req->src=%pK areq_ctx->src.nents=%u areq_ctx->assoc.nents=%u assoclen:%u cryptlen=%u\n",
662+ sg_virt(req->src), areq_ctx->src.nents, areq_ctx->assoc.nents,
663+ req->assoclen, req->cryptlen);
686664 size_to_unmap = req->assoclen + req->cryptlen;
687665 if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_ENCRYPT)
688666 size_to_unmap += areq_ctx->req_authsize;
689667 if (areq_ctx->is_gcm4543)
690668 size_to_unmap += crypto_aead_ivsize(tfm);
691669
692− dma_unmap_sg(dev, req->src, ssi_buffer_mgr_get_sgl_nents(req->src, size_to_unmap, &dummy, &chained), DMA_BIDIRECTIONAL);
670+ dma_unmap_sg(dev, req->src,
671+ ssi_buffer_mgr_get_sgl_nents(dev, req->src, size_to_unmap,
672+ &dummy, &chained),
673+ DMA_BIDIRECTIONAL);
693674 if (unlikely(req->src != req->dst)) {
694− SSI_LOG_DEBUG("Unmapping dst sgl: req->dst=%pK\n",
695− sg_virt(req->dst));
675+ dev_dbg(dev, "Unmapping dst sgl: req->dst=%pK\n",
676+ sg_virt(req->dst));
696677 dma_unmap_sg(dev, req->dst,
697− ssi_buffer_mgr_get_sgl_nents(req->dst,
678+ ssi_buffer_mgr_get_sgl_nents(dev, req->dst,
698679 size_to_unmap,
699− &dummy,
700− &chained),
680+ &dummy, &chained),
701681 DMA_BIDIRECTIONAL);
702682 }
703683 if (drvdata->coherent &&
@@ -712,13 +692,14 @@ void ssi_buffer_mgr_unmap_aead_request( · 8 unmodified lines
712692 * data memory overriding that caused by cache coherence problem.
713693 */
714694 ssi_buffer_mgr_copy_scatterlist_portion(
715− areq_ctx->backup_mac, req->src,
695+ dev, areq_ctx->backup_mac, req->src,
716696 size_to_skip + req->cryptlen - areq_ctx->req_authsize,
717697 size_to_skip + req->cryptlen, SSI_SG_FROM_BUF);
718698 }
719699 }
720700
721701 static inline int ssi_buffer_mgr_get_aead_icv_nents(
702+ struct device *dev,
722703 struct scatterlist *sgl,
723704 unsigned int sgl_nents,
724705 unsigned int authsize,
@@ -757,12 +738,12 @@ static inline int ssi_buffer_mgr_get_aead_icv_nents( · 32 unmodified lines
757738 nents = 2;
758739 *is_icv_fragmented = true;
759740 } else {
760− SSI_LOG_ERR("Unsupported num. of ICV fragments (> %d)\n",
761− MAX_ICV_NENTS_SUPPORTED);
741+ dev_err(dev, "Unsupported num. of ICV fragments (> %d)\n",
742+ MAX_ICV_NENTS_SUPPORTED);
762743 nents = -1; /*unsupported*/
763744 }
764− SSI_LOG_DEBUG("is_frag=%s icv_nents=%u\n",
765− (*is_icv_fragmented ? "true" : "false"), nents);
745+ dev_dbg(dev, "is_frag=%s icv_nents=%u\n",
746+ (*is_icv_fragmented ? "true" : "false"), nents);
766747
767748 return nents;
768749 }
@@ -775,7 +756,7 @@ static inline int ssi_buffer_mgr_aead_chain_iv( · 6 unmodified lines
775756 {
776757 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
777758 unsigned int hw_iv_size = areq_ctx->hw_iv_size;
778− struct device *dev = &drvdata->plat_dev->dev;
759+ struct device *dev = drvdata_to_dev(drvdata);
779760 int rc = 0;
780761
781762 if (unlikely(!req->iv)) {
@@ -786,22 +767,22 @@ static inline int ssi_buffer_mgr_aead_chain_iv( · 4 unmodified lines
786767 areq_ctx->gen_ctx.iv_dma_addr = dma_map_single(dev, req->iv, hw_iv_size,
787768 DMA_BIDIRECTIONAL);
788769 if (unlikely(dma_mapping_error(dev, areq_ctx->gen_ctx.iv_dma_addr))) {
789− SSI_LOG_ERR("Mapping iv %u B at va=%pK for DMA failed\n",
790− hw_iv_size, req->iv);
770+ dev_err(dev, "Mapping iv %u B at va=%pK for DMA failed\n",
771+ hw_iv_size, req->iv);
791772 rc = -ENOMEM;
792773 goto chain_iv_exit;
793774 }
794775
795− SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=%pad\n",
796− hw_iv_size, req->iv,
797− areq_ctx->gen_ctx.iv_dma_addr);
776+ dev_dbg(dev, "Mapped iv %u B at va=%pK to dma=%pad\n",
777+ hw_iv_size, req->iv, &areq_ctx->gen_ctx.iv_dma_addr);
798778 if (do_chain && areq_ctx->plaintext_authenticate_only) { // TODO: what about CTR?? ask Ron
799779 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
800780 unsigned int iv_size_to_authenc = crypto_aead_ivsize(tfm);
801781 unsigned int iv_ofs = GCM_BLOCK_RFC4_IV_OFFSET;
802782 /* Chain to given list */
803783 ssi_buffer_mgr_add_buffer_entry(
804− sg_data, areq_ctx->gen_ctx.iv_dma_addr + iv_ofs,
784+ dev, sg_data,
785+ areq_ctx->gen_ctx.iv_dma_addr + iv_ofs,
805786 iv_size_to_authenc, is_last,
806787 &areq_ctx->assoc.mlli_nents);
807788 areq_ctx->assoc_buff_type = SSI_DMA_BUF_MLLI;
@@ -824,6 +805,7 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( · 16 unmodified lines
824805 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
825806 unsigned int sg_index = 0;
826807 u32 size_of_assoc = req->assoclen;
808+ struct device *dev = drvdata_to_dev(drvdata);
827809
828810 if (areq_ctx->is_gcm4543)
829811 size_of_assoc += crypto_aead_ivsize(tfm);
@@ -837,9 +819,9 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( · 7 unmodified lines
837819 areq_ctx->assoc_buff_type = SSI_DMA_BUF_NULL;
838820 areq_ctx->assoc.nents = 0;
839821 areq_ctx->assoc.mlli_nents = 0;
840− SSI_LOG_DEBUG("Chain assoc of length 0: buff_type=%s nents=%u\n",
841− GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
842− areq_ctx->assoc.nents);
822+ dev_dbg(dev, "Chain assoc of length 0: buff_type=%s nents=%u\n",
823+ GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
824+ areq_ctx->assoc.nents);
843825 goto chain_assoc_exit;
844826 }
845827
@@ -853,16 +835,16 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( · 7 unmodified lines
853835 current_sg = sg_next(current_sg);
854836 //if have reached the end of the sgl, then this is unexpected
855837 if (!current_sg) {
856− SSI_LOG_ERR("reached end of sg list. unexpected\n");
857− BUG();
838+ dev_err(dev, "reached end of sg list. unexpected\n");
839+ return -EINVAL;
858840 }
859841 sg_index += current_sg->length;
860842 mapped_nents++;
861843 }
862844 }
863845 if (unlikely(mapped_nents > LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES)) {
864− SSI_LOG_ERR("Too many fragments. current %d max %d\n",
865− mapped_nents, LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES);
846+ dev_err(dev, "Too many fragments. current %d max %d\n",
847+ mapped_nents, LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES);
866848 return -ENOMEM;
867849 }
868850 areq_ctx->assoc.nents = mapped_nents;
@@ -873,9 +855,9 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( · 4 unmodified lines
873855 if (areq_ctx->ccm_hdr_size != ccm_header_size_null) {
874856 if (unlikely((mapped_nents + 1) >
875857 LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES)) {
876− SSI_LOG_ERR("CCM case.Too many fragments. Current %d max %d\n",
877− (areq_ctx->assoc.nents + 1),
878− LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES);
858+ dev_err(dev, "CCM case.Too many fragments. Current %d max %d\n",
859+ (areq_ctx->assoc.nents + 1),
860+ LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES);
879861 rc = -ENOMEM;
880862 goto chain_assoc_exit;
881863 }
@@ -889,11 +871,11 @@ static inline int ssi_buffer_mgr_aead_chain_assoc( · 7 unmodified lines
889871
890872 if (unlikely((do_chain) ||
891873 (areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI))) {
892− SSI_LOG_DEBUG("Chain assoc: buff_type=%s nents=%u\n",
893− GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
894− areq_ctx->assoc.nents);
874+ dev_dbg(dev, "Chain assoc: buff_type=%s nents=%u\n",
875+ GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
876+ areq_ctx->assoc.nents);
895877 ssi_buffer_mgr_add_scatterlist_entry(
896− sg_data, areq_ctx->assoc.nents,
878+ dev, sg_data, areq_ctx->assoc.nents,
897879 req->src, req->assoclen, 0, is_last,
898880 &areq_ctx->assoc.mlli_nents);
899881 areq_ctx->assoc_buff_type = SSI_DMA_BUF_MLLI;
@@ -951,10 +933,11 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 51 unmodified lines
951933 unsigned int authsize = areq_ctx->req_authsize;
952934 int rc = 0, icv_nents;
953935 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
936+ struct device *dev = drvdata_to_dev(drvdata);
954937
955938 if (likely(req->src == req->dst)) {
956939 /*INPLACE*/
957− ssi_buffer_mgr_add_scatterlist_entry(sg_data,
940+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data,
958941 areq_ctx->src.nents,
959942 areq_ctx->src_sgl,
960943 areq_ctx->cryptlen,
@@ -962,7 +945,8 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 1 unmodified line
962945 is_last_table,
963946 &areq_ctx->src.mlli_nents);
964947
965− icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->src_sgl,
948+ icv_nents = ssi_buffer_mgr_get_aead_icv_nents(dev,
949+ areq_ctx->src_sgl,
966950 areq_ctx->src.nents,
967951 authsize,
968952 *src_last_bytes,
@@ -990,7 +974,8 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 21 unmodified lines
990974 skip += crypto_aead_ivsize(tfm);
991975
992976 ssi_buffer_mgr_copy_scatterlist_portion(
993− areq_ctx->backup_mac, req->src,
977+ dev, areq_ctx->backup_mac,
978+ req->src,
994979 (skip + req->cryptlen -
995980 areq_ctx->req_authsize),
996981 skip + req->cryptlen,
@@ -1013,14 +998,14 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 16 unmodified lines
1013998
1014999 } else if (direct == DRV_CRYPTO_DIRECTION_DECRYPT) {
10151000 /*NON-INPLACE and DECRYPT*/
1016− ssi_buffer_mgr_add_scatterlist_entry(sg_data,
1001+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data,
10171002 areq_ctx->src.nents,
10181003 areq_ctx->src_sgl,
10191004 areq_ctx->cryptlen,
10201005 areq_ctx->src_offset,
10211006 is_last_table,
10221007 &areq_ctx->src.mlli_nents);
1023− ssi_buffer_mgr_add_scatterlist_entry(sg_data,
1008+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data,
10241009 areq_ctx->dst.nents,
10251010 areq_ctx->dst_sgl,
10261011 areq_ctx->cryptlen,
@@ -1028,7 +1013,8 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 1 unmodified line
10281013 is_last_table,
10291014 &areq_ctx->dst.mlli_nents);
10301015
1031− icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->src_sgl,
1016+ icv_nents = ssi_buffer_mgr_get_aead_icv_nents(dev,
1017+ areq_ctx->src_sgl,
10321018 areq_ctx->src.nents,
10331019 authsize,
10341020 *src_last_bytes,
@@ -1043,15 +1029,15 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 8 unmodified lines
10431029 * verification is made by CPU compare in order to simplify
10441030 * MAC verification upon request completion
10451031 */
1046− u32 size_to_skip = req->assoclen;
1032+ u32 size_to_skip = req->assoclen;
10471033
1048− if (areq_ctx->is_gcm4543)
1049− size_to_skip += crypto_aead_ivsize(tfm);
1034+ if (areq_ctx->is_gcm4543)
1035+ size_to_skip += crypto_aead_ivsize(tfm);
10501036
1051− ssi_buffer_mgr_copy_scatterlist_portion(
1052− areq_ctx->backup_mac, req->src,
1053− size_to_skip + req->cryptlen - areq_ctx->req_authsize,
1054− size_to_skip + req->cryptlen, SSI_SG_TO_BUF);
1037+ ssi_buffer_mgr_copy_scatterlist_portion(
1038+ dev, areq_ctx->backup_mac, req->src,
1039+ size_to_skip + req->cryptlen - areq_ctx->req_authsize,
1040+ size_to_skip + req->cryptlen, SSI_SG_TO_BUF);
10551041 areq_ctx->icv_virt_addr = areq_ctx->backup_mac;
10561042 } else { /* Contig. ICV */
10571043 /*Should hanlde if the sg is not contig.*/
@@ -1065,14 +1051,14 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 7 unmodified lines
10651051
10661052 } else {
10671053 /*NON-INPLACE and ENCRYPT*/
1068− ssi_buffer_mgr_add_scatterlist_entry(sg_data,
1054+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data,
10691055 areq_ctx->dst.nents,
10701056 areq_ctx->dst_sgl,
10711057 areq_ctx->cryptlen,
10721058 areq_ctx->dst_offset,
10731059 is_last_table,
10741060 &areq_ctx->dst.mlli_nents);
1075− ssi_buffer_mgr_add_scatterlist_entry(sg_data,
1061+ ssi_buffer_mgr_add_scatterlist_entry(dev, sg_data,
10761062 areq_ctx->src.nents,
10771063 areq_ctx->src_sgl,
10781064 areq_ctx->cryptlen,
@@ -1080,7 +1066,8 @@ static inline int ssi_buffer_mgr_prepare_aead_data_mlli( · 1 unmodified line
10801066 is_last_table,
10811067 &areq_ctx->src.mlli_nents);
10821068
1083− icv_nents = ssi_buffer_mgr_get_aead_icv_nents(areq_ctx->dst_sgl,
1069+ icv_nents = ssi_buffer_mgr_get_aead_icv_nents(dev,
1070+ areq_ctx->dst_sgl,
10841071 areq_ctx->dst.nents,
10851072 authsize,
10861073 *dst_last_bytes,
@@ -1115,7 +1102,7 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 28 unmodified lines
11151102 bool is_last_table, bool do_chain)
11161103 {
11171104 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
1118− struct device *dev = &drvdata->plat_dev->dev;
1105+ struct device *dev = drvdata_to_dev(drvdata);
11191106 enum drv_crypto_direction direct = areq_ctx->gen_ctx.op_type;
11201107 unsigned int authsize = areq_ctx->req_authsize;
11211108 int src_last_bytes = 0, dst_last_bytes = 0;
@@ -1134,10 +1121,9 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 12 unmodified lines
11341121
11351122 offset = size_to_skip;
11361123
1137− if (!sg_data) {
1138− rc = -EINVAL;
1139− goto chain_data_exit;
1140− }
1124+ if (!sg_data)
1125+ return -EINVAL;
1126+
11411127 areq_ctx->src_sgl = req->src;
11421128 areq_ctx->dst_sgl = req->dst;
11431129
@@ -1145,7 +1131,10 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 1 unmodified line
11451131 size_for_map += crypto_aead_ivsize(tfm);
11461132
11471133 size_for_map += (direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ? authsize : 0;
1148− src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->src, size_for_map, &src_last_bytes, &chained);
1134+ src_mapped_nents = ssi_buffer_mgr_get_sgl_nents(dev, req->src,
1135+ size_for_map,
1136+ &src_last_bytes,
1137+ &chained);
11491138 sg_index = areq_ctx->src_sgl->length;
11501139 //check where the data starts
11511140 while (sg_index <= size_to_skip) {
@@ -1153,15 +1142,15 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 1 unmodified line
11531142 areq_ctx->src_sgl = sg_next(areq_ctx->src_sgl);
11541143 //if have reached the end of the sgl, then this is unexpected
11551144 if (!areq_ctx->src_sgl) {
1156− SSI_LOG_ERR("reached end of sg list. unexpected\n");
1157− BUG();
1145+ dev_err(dev, "reached end of sg list. unexpected\n");
1146+ return -EINVAL;
11581147 }
11591148 sg_index += areq_ctx->src_sgl->length;
11601149 src_mapped_nents--;
11611150 }
11621151 if (unlikely(src_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) {
1163− SSI_LOG_ERR("Too many fragments. current %d max %d\n",
1164− src_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES);
1152+ dev_err(dev, "Too many fragments. current %d max %d\n",
1153+ src_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES);
11651154 return -ENOMEM;
11661155 }
11671156
@@ -1187,7 +1176,10 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 19 unmodified lines
11871176 }
11881177 }
11891178
1190− dst_mapped_nents = ssi_buffer_mgr_get_sgl_nents(req->dst, size_for_map, &dst_last_bytes, &chained);
1179+ dst_mapped_nents = ssi_buffer_mgr_get_sgl_nents(dev, req->dst,
1180+ size_for_map,
1181+ &dst_last_bytes,
1182+ &chained);
11911183 sg_index = areq_ctx->dst_sgl->length;
11921184 offset = size_to_skip;
11931185
@@ -1197,15 +1189,15 @@ static inline int ssi_buffer_mgr_aead_chain_data( · 3 unmodified lines
11971189 areq_ctx->dst_sgl = sg_next(areq_ctx->dst_sgl);
11981190 //if have reached the end of the sgl, then this is unexpected
11991191 if (!areq_ctx->dst_sgl) {
1200− SSI_LOG_ERR("reached end of sg list. unexpected\n");
1201− BUG();
1192+ dev_err(dev, "reached end of sg list. unexpected\n");
1193+ return -EINVAL;
12021194 }
12031195 sg_index += areq_ctx->dst_sgl->length;
12041196 dst_mapped_nents--;
12051197 }
12061198 if (unlikely(dst_mapped_nents > LLI_MAX_NUM_OF_DATA_ENTRIES)) {
1207− SSI_LOG_ERR("Too many fragments. current %d max %d\n",
1208− dst_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES);
1199+ dev_err(dev, "Too many fragments. current %d max %d\n",
1200+ dst_mapped_nents, LLI_MAX_NUM_OF_DATA_ENTRIES);
12091201 return -ENOMEM;
12101202 }
12111203 areq_ctx->dst.nents = dst_mapped_nents;
@@ -1285,7 +1277,7 @@ int ssi_buffer_mgr_map_aead_request( · 73 unmodified lines
12851277 {
12861278 struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
12871279 struct mlli_params *mlli_params = &areq_ctx->mlli_params;
1288− struct device *dev = &drvdata->plat_dev->dev;
1280+ struct device *dev = drvdata_to_dev(drvdata);
12891281 struct buffer_array sg_data;
12901282 unsigned int authsize = areq_ctx->req_authsize;
12911283 struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle;
@@ -1312,7 +1304,7 @@ int ssi_buffer_mgr_map_aead_request( · 20 unmodified lines
13121304 * data memory overriding that caused by cache coherence problem.
13131305 */
13141306 ssi_buffer_mgr_copy_scatterlist_portion(
1315− areq_ctx->backup_mac, req->src,
1307+ dev, areq_ctx->backup_mac, req->src,
13161308 size_to_skip + req->cryptlen - areq_ctx->req_authsize,
13171309 size_to_skip + req->cryptlen, SSI_SG_TO_BUF);
13181310 }
@@ -1327,8 +1319,8 @@ int ssi_buffer_mgr_map_aead_request( · 8 unmodified lines
13271319 MAX_MAC_SIZE,
13281320 DMA_BIDIRECTIONAL);
13291321 if (unlikely(dma_mapping_error(dev, areq_ctx->mac_buf_dma_addr))) {
1330− SSI_LOG_ERR("Mapping mac_buf %u B at va=%pK for DMA failed\n",
1331− MAX_MAC_SIZE, areq_ctx->mac_buf);
1322+ dev_err(dev, "Mapping mac_buf %u B at va=%pK for DMA failed\n",
1323+ MAX_MAC_SIZE, areq_ctx->mac_buf);
13321324 rc = -ENOMEM;
13331325 goto aead_map_failure;
13341326 }
@@ -1340,9 +1332,10 @@ int ssi_buffer_mgr_map_aead_request( · 5 unmodified lines
13401332 DMA_TO_DEVICE);
13411333
13421334 if (unlikely(dma_mapping_error(dev, areq_ctx->ccm_iv0_dma_addr))) {
1343− SSI_LOG_ERR("Mapping mac_buf %u B at va=%pK "
1344− "for DMA failed\n", AES_BLOCK_SIZE,
1345− (areq_ctx->ccm_config + CCM_CTR_COUNT_0_OFFSET));
1335+ dev_err(dev, "Mapping mac_buf %u B at va=%pK for DMA failed\n",
1336+ AES_BLOCK_SIZE,
1337+ (areq_ctx->ccm_config +
1338+ CCM_CTR_COUNT_0_OFFSET));
13461339 areq_ctx->ccm_iv0_dma_addr = 0;
13471340 rc = -ENOMEM;
13481341 goto aead_map_failure;
@@ -1362,8 +1355,8 @@ int ssi_buffer_mgr_map_aead_request( · 13 unmodified lines
13621355 AES_BLOCK_SIZE,
13631356 DMA_BIDIRECTIONAL);
13641357 if (unlikely(dma_mapping_error(dev, areq_ctx->hkey_dma_addr))) {
1365− SSI_LOG_ERR("Mapping hkey %u B at va=%pK for DMA failed\n",
1366− AES_BLOCK_SIZE, areq_ctx->hkey);
1358+ dev_err(dev, "Mapping hkey %u B at va=%pK for DMA failed\n",
1359+ AES_BLOCK_SIZE, areq_ctx->hkey);
13671360 rc = -ENOMEM;
13681361 goto aead_map_failure;
13691362 }
@@ -1373,8 +1366,8 @@ int ssi_buffer_mgr_map_aead_request( · 3 unmodified lines
13731366 AES_BLOCK_SIZE,
13741367 DMA_TO_DEVICE);
13751368 if (unlikely(dma_mapping_error(dev, areq_ctx->gcm_block_len_dma_addr))) {
1376− SSI_LOG_ERR("Mapping gcm_len_block %u B at va=%pK for DMA failed\n",
1377− AES_BLOCK_SIZE, &areq_ctx->gcm_len_block);
1369+ dev_err(dev, "Mapping gcm_len_block %u B at va=%pK for DMA failed\n",
1370+ AES_BLOCK_SIZE, &areq_ctx->gcm_len_block);
13781371 rc = -ENOMEM;
13791372 goto aead_map_failure;
13801373 }
@@ -1385,9 +1378,8 @@ int ssi_buffer_mgr_map_aead_request( · 4 unmodified lines
13851378 DMA_TO_DEVICE);
13861379
13871380 if (unlikely(dma_mapping_error(dev, areq_ctx->gcm_iv_inc1_dma_addr))) {
1388− SSI_LOG_ERR("Mapping gcm_iv_inc1 %u B at va=%pK "
1389− "for DMA failed\n", AES_BLOCK_SIZE,
1390− (areq_ctx->gcm_iv_inc1));
1381+ dev_err(dev, "Mapping gcm_iv_inc1 %u B at va=%pK for DMA failed\n",
1382+ AES_BLOCK_SIZE, (areq_ctx->gcm_iv_inc1));
13911383 areq_ctx->gcm_iv_inc1_dma_addr = 0;
13921384 rc = -ENOMEM;
13931385 goto aead_map_failure;
@@ -1399,9 +1391,8 @@ int ssi_buffer_mgr_map_aead_request( · 5 unmodified lines
13991391 DMA_TO_DEVICE);
14001392
14011393 if (unlikely(dma_mapping_error(dev, areq_ctx->gcm_iv_inc2_dma_addr))) {
1402− SSI_LOG_ERR("Mapping gcm_iv_inc2 %u B at va=%pK "
1403− "for DMA failed\n", AES_BLOCK_SIZE,
1404− (areq_ctx->gcm_iv_inc2));
1394+ dev_err(dev, "Mapping gcm_iv_inc2 %u B at va=%pK for DMA failed\n",
1395+ AES_BLOCK_SIZE, (areq_ctx->gcm_iv_inc2));
14051396 areq_ctx->gcm_iv_inc2_dma_addr = 0;
14061397 rc = -ENOMEM;
14071398 goto aead_map_failure;
@@ -1481,9 +1472,10 @@ int ssi_buffer_mgr_map_aead_request( · 73 unmodified lines
14811472 goto aead_map_failure;
14821473
14831474 ssi_buffer_mgr_update_aead_mlli_nents(drvdata, req);
1484− SSI_LOG_DEBUG("assoc params mn %d\n", areq_ctx->assoc.mlli_nents);
1485− SSI_LOG_DEBUG("src params mn %d\n", areq_ctx->src.mlli_nents);
1486− SSI_LOG_DEBUG("dst params mn %d\n", areq_ctx->dst.mlli_nents);
1475+ dev_dbg(dev, "assoc params mn %d\n",
1476+ areq_ctx->assoc.mlli_nents);
1477+ dev_dbg(dev, "src params mn %d\n", areq_ctx->src.mlli_nents);
1478+ dev_dbg(dev, "dst params mn %d\n", areq_ctx->dst.mlli_nents);
14871479 }
14881480 return 0;
14891481
@@ -1496,7 +1488,7 @@ int ssi_buffer_mgr_map_hash_request_final( · 6 unmodified lines
14961488 struct ssi_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, bool do_update)
14971489 {
14981490 struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx;
1499− struct device *dev = &drvdata->plat_dev->dev;
1491+ struct device *dev = drvdata_to_dev(drvdata);
15001492 u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 :
15011493 areq_ctx->buff0;
15021494 u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt :
@@ -1507,11 +1499,8 @@ int ssi_buffer_mgr_map_hash_request_final( · 4 unmodified lines
15071499 u32 dummy = 0;
15081500 u32 mapped_nents = 0;
15091501
1510− SSI_LOG_DEBUG(" final params : curr_buff=%pK "
1511− "curr_buff_cnt=0x%X nbytes = 0x%X "
1512− "src=%pK curr_index=%u\n",
1513− curr_buff, *curr_buff_cnt, nbytes,
1514− src, areq_ctx->buff_index);
1502+ dev_dbg(dev, "final params : curr_buff=%pK curr_buff_cnt=0x%X nbytes = 0x%X src=%pK curr_index=%u\n",
1503+ curr_buff, *curr_buff_cnt, nbytes, src, areq_ctx->buff_index);
15151504 /* Init the type of the dma buffer */
15161505 areq_ctx->data_dma_buf_type = SSI_DMA_BUF_NULL;
15171506 mlli_params->curr_pool = NULL;
@@ -1557,7 +1546,7 @@ int ssi_buffer_mgr_map_hash_request_final( · 39 unmodified lines
15571546 if (unlikely(areq_ctx->data_dma_buf_type == SSI_DMA_BUF_MLLI)) {
15581547 mlli_params->curr_pool = buff_mgr->mlli_buffs_pool;
15591548 /* add the src data to the sg_data */
1560− ssi_buffer_mgr_add_scatterlist_entry(&sg_data,
1549+ ssi_buffer_mgr_add_scatterlist_entry(dev, &sg_data,
15611550 areq_ctx->in_nents,
15621551 src, nbytes, 0, true,
15631552 &areq_ctx->mlli_nents);
@@ -1568,8 +1557,8 @@ int ssi_buffer_mgr_map_hash_request_final( · 4 unmodified lines
15681557 }
15691558 /* change the buffer index for the unmap function */
15701559 areq_ctx->buff_index = (areq_ctx->buff_index ^ 1);
1571− SSI_LOG_DEBUG("areq_ctx->data_dma_buf_type = %s\n",
1572− GET_DMA_BUFFER_TYPE(areq_ctx->data_dma_buf_type));
1560+ dev_dbg(dev, "areq_ctx->data_dma_buf_type = %s\n",
1561+ GET_DMA_BUFFER_TYPE(areq_ctx->data_dma_buf_type));
15731562 return 0;
15741563
15751564 fail_unmap_din:
@@ -1586,7 +1575,7 @@ int ssi_buffer_mgr_map_hash_request_update( · 10 unmodified lines
15861575 struct ssi_drvdata *drvdata, void *ctx, struct scatterlist *src, unsigned int nbytes, unsigned int block_size)
15871576 {
15881577 struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx;
1589− struct device *dev = &drvdata->plat_dev->dev;
1578+ struct device *dev = drvdata_to_dev(drvdata);
15901579 u8 *curr_buff = areq_ctx->buff_index ? areq_ctx->buff1 :
15911580 areq_ctx->buff0;
15921581 u32 *curr_buff_cnt = areq_ctx->buff_index ? &areq_ctx->buff1_cnt :
@@ -1604,11 +1593,8 @@ int ssi_buffer_mgr_map_hash_request_update( · 11 unmodified lines
16041593 u32 dummy = 0;
16051594 u32 mapped_nents = 0;
16061595
1607− SSI_LOG_DEBUG(" update params : curr_buff=%pK "
1608− "curr_buff_cnt=0x%X nbytes=0x%X "
1609− "src=%pK curr_index=%u\n",
1610− curr_buff, *curr_buff_cnt, nbytes,
1611− src, areq_ctx->buff_index);
1596+ dev_dbg(dev, " update params : curr_buff=%pK curr_buff_cnt=0x%X nbytes=0x%X src=%pK curr_index=%u\n",
1597+ curr_buff, *curr_buff_cnt, nbytes, src, areq_ctx->buff_index);
16121598 /* Init the type of the dma buffer */
16131599 areq_ctx->data_dma_buf_type = SSI_DMA_BUF_NULL;
16141600 mlli_params->curr_pool = NULL;
@@ -1617,14 +1603,11 @@ int ssi_buffer_mgr_map_hash_request_update( · 2 unmodified lines
16171603 areq_ctx->in_nents = 0;
16181604
16191605 if (unlikely(total_in_len < block_size)) {
1620− SSI_LOG_DEBUG(" less than one block: curr_buff=%pK "
1621− "*curr_buff_cnt=0x%X copy_to=%pK\n",
1622− curr_buff, *curr_buff_cnt,
1623− &curr_buff[*curr_buff_cnt]);
1606+ dev_dbg(dev, " less than one block: curr_buff=%pK *curr_buff_cnt=0x%X copy_to=%pK\n",
1607+ curr_buff, *curr_buff_cnt, &curr_buff[*curr_buff_cnt]);
16241608 areq_ctx->in_nents =
1625− ssi_buffer_mgr_get_sgl_nents(src,
1626− nbytes,
1627− &dummy, NULL);
1609+ ssi_buffer_mgr_get_sgl_nents(dev, src, nbytes, &dummy,
1610+ NULL);
16281611 sg_copy_to_buffer(src, areq_ctx->in_nents,
16291612 &curr_buff[*curr_buff_cnt], nbytes);
16301613 *curr_buff_cnt += nbytes;
@@ -1636,17 +1619,15 @@ int ssi_buffer_mgr_map_hash_request_update( · 5 unmodified lines
16361619 /* update data len */
16371620 update_data_len = total_in_len - *next_buff_cnt;
16381621
1639− SSI_LOG_DEBUG(" temp length : *next_buff_cnt=0x%X "
1640− "update_data_len=0x%X\n",
1622+ dev_dbg(dev, " temp length : *next_buff_cnt=0x%X update_data_len=0x%X\n",
16411623 *next_buff_cnt, update_data_len);
16421624
16431625 /* Copy the new residue to next buffer */
16441626 if (*next_buff_cnt != 0) {
1645− SSI_LOG_DEBUG(" handle residue: next buff %pK skip data %u"
1646− " residue %u\n", next_buff,
1647− (update_data_len - *curr_buff_cnt),
1648− *next_buff_cnt);
1649− ssi_buffer_mgr_copy_scatterlist_portion(next_buff, src,
1627+ dev_dbg(dev, " handle residue: next buff %pK skip data %u residue %u\n",
1628+ next_buff, (update_data_len - *curr_buff_cnt),
1629+ *next_buff_cnt);
1630+ ssi_buffer_mgr_copy_scatterlist_portion(dev, next_buff, src,
16501631 (update_data_len - *curr_buff_cnt),
16511632 nbytes, SSI_SG_TO_BUF);
16521633 /* change the buffer index for next operation */
@@ -1688,7 +1669,7 @@ int ssi_buffer_mgr_map_hash_request_update( · 35 unmodified lines
16881669 if (unlikely(areq_ctx->data_dma_buf_type == SSI_DMA_BUF_MLLI)) {
16891670 mlli_params->curr_pool = buff_mgr->mlli_buffs_pool;
16901671 /* add the src data to the sg_data */
1691− ssi_buffer_mgr_add_scatterlist_entry(&sg_data,
1672+ ssi_buffer_mgr_add_scatterlist_entry(dev, &sg_data,
16921673 areq_ctx->in_nents,
16931674 src,
16941675 (update_data_len - *curr_buff_cnt),
@@ -1725,29 +1706,26 @@ void ssi_buffer_mgr_unmap_hash_request( · 30 unmodified lines
17251706 *allocated and should be released
17261707 */
17271708 if (areq_ctx->mlli_params.curr_pool) {
1728− SSI_LOG_DEBUG("free MLLI buffer: dma=%pad virt=%pK\n",
1729− areq_ctx->mlli_params.mlli_dma_addr,
1730− areq_ctx->mlli_params.mlli_virt_addr);
1709+ dev_dbg(dev, "free MLLI buffer: dma=%pad virt=%pK\n",
1710+ &areq_ctx->mlli_params.mlli_dma_addr,
1711+ areq_ctx->mlli_params.mlli_virt_addr);
17311712 dma_pool_free(areq_ctx->mlli_params.curr_pool,
17321713 areq_ctx->mlli_params.mlli_virt_addr,
17331714 areq_ctx->mlli_params.mlli_dma_addr);
17341715 }
17351716
17361717 if ((src) && likely(areq_ctx->in_nents != 0)) {
1737− SSI_LOG_DEBUG("Unmapped sg src: virt=%pK dma=%pad len=0x%X\n",
1738− sg_virt(src),
1739− sg_dma_address(src),
1740− sg_dma_len(src));
1718+ dev_dbg(dev, "Unmapped sg src: virt=%pK dma=%pad len=0x%X\n",
1719+ sg_virt(src), &sg_dma_address(src), sg_dma_len(src));
17411720 dma_unmap_sg(dev, src,
17421721 areq_ctx->in_nents, DMA_TO_DEVICE);
17431722 }
17441723
17451724 if (*prev_len != 0) {
1746− SSI_LOG_DEBUG("Unmapped buffer: areq_ctx->buff_sg=%pK"
1747− " dma=%pad len 0x%X\n",
1748− sg_virt(areq_ctx->buff_sg),
1749− sg_dma_address(areq_ctx->buff_sg),
1750− sg_dma_len(areq_ctx->buff_sg));
1725+ dev_dbg(dev, "Unmapped buffer: areq_ctx->buff_sg=%pK dma=%pad len 0x%X\n",
1726+ sg_virt(areq_ctx->buff_sg),
1727+ &sg_dma_address(areq_ctx->buff_sg),
1728+ sg_dma_len(areq_ctx->buff_sg));
17511729 dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE);
17521730 if (!do_revert) {
17531731 /* clean the previous data length for update operation */
@@ -1761,7 +1739,7 @@ void ssi_buffer_mgr_unmap_hash_request( · 7 unmodified lines
17611739 int ssi_buffer_mgr_init(struct ssi_drvdata *drvdata)
17621740 {
17631741 struct buff_mgr_handle *buff_mgr_handle;
1764− struct device *dev = &drvdata->plat_dev->dev;
1742+ struct device *dev = drvdata_to_dev(drvdata);
17651743
17661744 buff_mgr_handle = kmalloc(sizeof(*buff_mgr_handle), GFP_KERNEL);
17671745 if (!buff_mgr_handle)
drivers/staging/ccree/ssi_buffer_mgr.h+4−1
@@ -80,7 +80,10 @@ int ssi_buffer_mgr_map_hash_request_update(struct ssi_drvdata *drvdata, void *ct · 79 unmodified lines
8080
8181 void ssi_buffer_mgr_unmap_hash_request(struct device *dev, void *ctx, struct scatterlist *src, bool do_revert);
8282
83−void ssi_buffer_mgr_copy_scatterlist_portion(u8 *dest, struct scatterlist *sg, u32 to_skip, u32 end, enum ssi_sg_cpy_direct direct);
83+void ssi_buffer_mgr_copy_scatterlist_portion(struct device *dev, u8 *dest,
84+ struct scatterlist *sg,
85+ u32 to_skip, u32 end,
86+ enum ssi_sg_cpy_direct direct);
8487
8588 void ssi_buffer_mgr_zero_sgl(struct scatterlist *sgl, u32 data_len);
8689
drivers/staging/ccree/ssi_cipher.c+95−94
@@ -181,45 +181,42 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) · 180 unmodified lines
181181 struct crypto_alg *alg = tfm->__crt_alg;
182182 struct ssi_crypto_alg *ssi_alg =
183183 container_of(alg, struct ssi_crypto_alg, crypto_alg);
184− struct device *dev;
184+ struct device *dev = drvdata_to_dev(ssi_alg->drvdata);
185185 int rc = 0;
186186 unsigned int max_key_buf_size = get_max_keysize(tfm);
187187
188− SSI_LOG_DEBUG("Initializing context @%p for %s\n",
189− ctx_p, crypto_tfm_alg_name(tfm));
188+ dev_dbg(dev, "Initializing context @%p for %s\n", ctx_p,
189+ crypto_tfm_alg_name(tfm));
190190
191191 ctx_p->cipher_mode = ssi_alg->cipher_mode;
192192 ctx_p->flow_mode = ssi_alg->flow_mode;
193193 ctx_p->drvdata = ssi_alg->drvdata;
194− dev = &ctx_p->drvdata->plat_dev->dev;
195194
196195 /* Allocate key buffer, cache line aligned */
197196 ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL | GFP_DMA);
198− if (!ctx_p->user.key) {
199− SSI_LOG_ERR("Allocating key buffer in context failed\n");
200− rc = -ENOMEM;
201− }
202− SSI_LOG_DEBUG("Allocated key buffer in context. key=@%p\n",
203− ctx_p->user.key);
197+ if (!ctx_p->user.key)
198+ return -ENOMEM;
199+
200+ dev_dbg(dev, "Allocated key buffer in context. key=@%p\n",
201+ ctx_p->user.key);
204202
205203 /* Map key buffer */
206204 ctx_p->user.key_dma_addr = dma_map_single(dev, (void *)ctx_p->user.key,
207205 max_key_buf_size,
208206 DMA_TO_DEVICE);
209207 if (dma_mapping_error(dev, ctx_p->user.key_dma_addr)) {
210− SSI_LOG_ERR("Mapping Key %u B at va=%pK for DMA failed\n",
211− max_key_buf_size, ctx_p->user.key);
208+ dev_err(dev, "Mapping Key %u B at va=%pK for DMA failed\n",
209+ max_key_buf_size, ctx_p->user.key);
212210 return -ENOMEM;
213211 }
214− SSI_LOG_DEBUG("Mapped key %u B at va=%pK to dma=%pad\n",
215− max_key_buf_size, ctx_p->user.key,
216− ctx_p->user.key_dma_addr);
212+ dev_dbg(dev, "Mapped key %u B at va=%pK to dma=%pad\n",
213+ max_key_buf_size, ctx_p->user.key, &ctx_p->user.key_dma_addr);
217214
218215 if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) {
219216 /* Alloc hash tfm for essiv */
220217 ctx_p->shash_tfm = crypto_alloc_shash("sha256-generic", 0, 0);
221218 if (IS_ERR(ctx_p->shash_tfm)) {
222− SSI_LOG_ERR("Error allocating hash tfm for ESSIV.\n");
219+ dev_err(dev, "Error allocating hash tfm for ESSIV.\n");
223220 return PTR_ERR(ctx_p->shash_tfm);
224221 }
225222 }
@@ -230,11 +227,11 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) · 4 unmodified lines
230227 static void ssi_blkcipher_exit(struct crypto_tfm *tfm)
231228 {
232229 struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
233− struct device *dev = &ctx_p->drvdata->plat_dev->dev;
230+ struct device *dev = drvdata_to_dev(ctx_p->drvdata);
234231 unsigned int max_key_buf_size = get_max_keysize(tfm);
235232
236− SSI_LOG_DEBUG("Clearing context @%p for %s\n",
237− crypto_tfm_ctx(tfm), crypto_tfm_alg_name(tfm));
233+ dev_dbg(dev, "Clearing context @%p for %s\n",
234+ crypto_tfm_ctx(tfm), crypto_tfm_alg_name(tfm));
238235
239236 if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) {
240237 /* Free hash tfm for essiv */
@@ -245,12 +242,12 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) · 4 unmodified lines
245242 /* Unmap key buffer */
246243 dma_unmap_single(dev, ctx_p->user.key_dma_addr, max_key_buf_size,
247244 DMA_TO_DEVICE);
248− SSI_LOG_DEBUG("Unmapped key buffer key_dma_addr=%pad\n",
249− ctx_p->user.key_dma_addr);
245+ dev_dbg(dev, "Unmapped key buffer key_dma_addr=%pad\n",
246+ &ctx_p->user.key_dma_addr);
250247
251248 /* Free key buffer in context */
252249 kfree(ctx_p->user.key);
253− SSI_LOG_DEBUG("Free key buffer in context. key=@%p\n", ctx_p->user.key);
250+ dev_dbg(dev, "Free key buffer in context. key=@%p\n", ctx_p->user.key);
254251 }
255252
256253 struct tdes_keys {
@@ -298,16 +295,14 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 41 unmodified lines
298295 unsigned int keylen)
299296 {
300297 struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
301− struct device *dev = &ctx_p->drvdata->plat_dev->dev;
298+ struct device *dev = drvdata_to_dev(ctx_p->drvdata);
302299 u32 tmp[DES_EXPKEY_WORDS];
303300 unsigned int max_key_buf_size = get_max_keysize(tfm);
304301
305− SSI_LOG_DEBUG("Setting key in context @%p for %s. keylen=%u\n",
306− ctx_p, crypto_tfm_alg_name(tfm), keylen);
302+ dev_dbg(dev, "Setting key in context @%p for %s. keylen=%u\n",
303+ ctx_p, crypto_tfm_alg_name(tfm), keylen);
307304 dump_byte_array("key", (u8 *)key, keylen);
308305
309− SSI_LOG_DEBUG("after FIPS check");
310−
311306 /* STAT_PHASE_0: Init and sanity checks */
312307
313308 #if SSI_CC_HAS_MULTI2
@@ -317,7 +312,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 3 unmodified lines
317312 #endif /*SSI_CC_HAS_MULTI2*/
318313
319314 if (unlikely(validate_keys_sizes(ctx_p, keylen) != 0)) {
320− SSI_LOG_ERR("Unsupported key size %d.\n", keylen);
315+ dev_err(dev, "Unsupported key size %d.\n", keylen);
321316 crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
322317 return -EINVAL;
323318 }
@@ -327,13 +322,14 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 3 unmodified lines
327322 struct arm_hw_key_info *hki = (struct arm_hw_key_info *)key;
328323
329324 if (unlikely(ctx_p->flow_mode != S_DIN_to_AES)) {
330− SSI_LOG_ERR("HW key not supported for non-AES flows\n");
325+ dev_err(dev, "HW key not supported for non-AES flows\n");
331326 return -EINVAL;
332327 }
333328
334329 ctx_p->hw.key1_slot = hw_key_to_cc_hw_key(hki->hw_key1);
335330 if (unlikely(ctx_p->hw.key1_slot == END_OF_KEYS)) {
336− SSI_LOG_ERR("Unsupported hw key1 number (%d)\n", hki->hw_key1);
331+ dev_err(dev, "Unsupported hw key1 number (%d)\n",
332+ hki->hw_key1);
337333 return -EINVAL;
338334 }
339335
@@ -341,18 +337,20 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 1 unmodified line
341337 (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) ||
342338 (ctx_p->cipher_mode == DRV_CIPHER_BITLOCKER)) {
343339 if (unlikely(hki->hw_key1 == hki->hw_key2)) {
344− SSI_LOG_ERR("Illegal hw key numbers (%d,%d)\n", hki->hw_key1, hki->hw_key2);
340+ dev_err(dev, "Illegal hw key numbers (%d,%d)\n",
341+ hki->hw_key1, hki->hw_key2);
345342 return -EINVAL;
346343 }
347344 ctx_p->hw.key2_slot = hw_key_to_cc_hw_key(hki->hw_key2);
348345 if (unlikely(ctx_p->hw.key2_slot == END_OF_KEYS)) {
349− SSI_LOG_ERR("Unsupported hw key2 number (%d)\n", hki->hw_key2);
346+ dev_err(dev, "Unsupported hw key2 number (%d)\n",
347+ hki->hw_key2);
350348 return -EINVAL;
351349 }
352350 }
353351
354352 ctx_p->keylen = keylen;
355− SSI_LOG_DEBUG("ssi_is_hw_key ret 0");
353+ dev_dbg(dev, "ssi_is_hw_key ret 0");
356354
357355 return 0;
358356 }
@@ -362,19 +360,19 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 3 unmodified lines
362360 if (unlikely(!des_ekey(tmp, key)) &&
363361 (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_WEAK_KEY)) {
364362 tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
365− SSI_LOG_DEBUG("weak DES key");
363+ dev_dbg(dev, "weak DES key");
366364 return -EINVAL;
367365 }
368366 }
369367 if ((ctx_p->cipher_mode == DRV_CIPHER_XTS) &&
370368 xts_check_key(tfm, key, keylen) != 0) {
371− SSI_LOG_DEBUG("weak XTS key");
369+ dev_dbg(dev, "weak XTS key");
372370 return -EINVAL;
373371 }
374372 if ((ctx_p->flow_mode == S_DIN_to_DES) &&
375373 (keylen == DES3_EDE_KEY_SIZE) &&
376374 ssi_verify_3des_keys(key, keylen) != 0) {
377− SSI_LOG_DEBUG("weak 3DES key");
375+ dev_dbg(dev, "weak 3DES key");
378376 return -EINVAL;
379377 }
380378
@@ -389,7 +387,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 8 unmodified lines
389387 if (ctx_p->key_round_number < CC_MULTI2_MIN_NUM_ROUNDS ||
390388 ctx_p->key_round_number > CC_MULTI2_MAX_NUM_ROUNDS) {
391389 crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
392− SSI_LOG_DEBUG("SSI_CC_HAS_MULTI2 einval");
390+ dev_dbg(dev, "SSI_CC_HAS_MULTI2 einval");
393391 return -EINVAL;
394392 #endif /*SSI_CC_HAS_MULTI2*/
395393 } else {
@@ -407,7 +405,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 11 unmodified lines
407405
408406 err = crypto_shash_digest(desc, ctx_p->user.key, key_len, ctx_p->user.key + key_len);
409407 if (err) {
410− SSI_LOG_ERR("Failed to hash ESSIV key.\n");
408+ dev_err(dev, "Failed to hash ESSIV key.\n");
411409 return err;
412410 }
413411 }
@@ -416,7 +414,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm, · 2 unmodified lines
416414 max_key_buf_size, DMA_TO_DEVICE);
417415 ctx_p->keylen = keylen;
418416
419− SSI_LOG_DEBUG("return safely");
417+ dev_dbg(dev, "return safely");
420418 return 0;
421419 }
422420
@@ -430,6 +428,7 @@ ssi_blkcipher_create_setup_desc( · 7 unmodified lines
430428 unsigned int *seq_size)
431429 {
432430 struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
431+ struct device *dev = drvdata_to_dev(ctx_p->drvdata);
433432 int cipher_mode = ctx_p->cipher_mode;
434433 int flow_mode = ctx_p->flow_mode;
435434 int direction = req_ctx->gen_ctx.op_type;
@@ -540,8 +539,7 @@ ssi_blkcipher_create_setup_desc( · 104 unmodified lines
540539 (*seq_size)++;
541540 break;
542541 default:
543− SSI_LOG_ERR("Unsupported cipher mode (%d)\n", cipher_mode);
544− BUG();
542+ dev_err(dev, "Unsupported cipher mode (%d)\n", cipher_mode);
545543 }
546544 }
547545
@@ -601,6 +599,7 @@ ssi_blkcipher_create_data_desc( · 53 unmodified lines
601599 unsigned int *seq_size)
602600 {
603601 struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
602+ struct device *dev = drvdata_to_dev(ctx_p->drvdata);
604603 unsigned int flow_mode = ctx_p->flow_mode;
605604
606605 switch (ctx_p->flow_mode) {
@@ -616,15 +615,15 @@ ssi_blkcipher_create_data_desc( · 9 unmodified lines
616615 break;
617616 #endif /*SSI_CC_HAS_MULTI2*/
618617 default:
619− SSI_LOG_ERR("invalid flow mode, flow_mode = %d\n", flow_mode);
618+ dev_err(dev, "invalid flow mode, flow_mode = %d\n", flow_mode);
620619 return;
621620 }
622621 /* Process */
623622 if (likely(req_ctx->dma_buf_type == SSI_DMA_BUF_DLLI)) {
624− SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n",
625− sg_dma_address(src), nbytes);
626− SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n",
627− sg_dma_address(dst), nbytes);
623+ dev_dbg(dev, " data params addr %pad length 0x%X\n",
624+ &sg_dma_address(src), nbytes);
625+ dev_dbg(dev, " data params addr %pad length 0x%X\n",
626+ &sg_dma_address(dst), nbytes);
628627 hw_desc_init(&desc[*seq_size]);
629628 set_din_type(&desc[*seq_size], DMA_DLLI, sg_dma_address(src),
630629 nbytes, NS_BIT);
@@ -637,9 +636,8 @@ ssi_blkcipher_create_data_desc( · 6 unmodified lines
637636 (*seq_size)++;
638637 } else {
639638 /* bypass */
640− SSI_LOG_DEBUG(" bypass params addr %pad "
641− "length 0x%X addr 0x%08X\n",
642− req_ctx->mlli_params.mlli_dma_addr,
639+ dev_dbg(dev, " bypass params addr %pad length 0x%X addr 0x%08X\n",
640+ &req_ctx->mlli_params.mlli_dma_addr,
643641 req_ctx->mlli_params.mlli_len,
644642 (unsigned int)ctx_p->drvdata->mlli_sram_addr);
645643 hw_desc_init(&desc[*seq_size]);
@@ -657,21 +655,18 @@ ssi_blkcipher_create_data_desc( · 11 unmodified lines
657655 ctx_p->drvdata->mlli_sram_addr,
658656 req_ctx->in_mlli_nents, NS_BIT);
659657 if (req_ctx->out_nents == 0) {
660− SSI_LOG_DEBUG(" din/dout params addr 0x%08X "
661− "addr 0x%08X\n",
662− (unsigned int)ctx_p->drvdata->mlli_sram_addr,
663− (unsigned int)ctx_p->drvdata->mlli_sram_addr);
658+ dev_dbg(dev, " din/dout params addr 0x%08X addr 0x%08X\n",
659+ (unsigned int)ctx_p->drvdata->mlli_sram_addr,
660+ (unsigned int)ctx_p->drvdata->mlli_sram_addr);
664661 set_dout_mlli(&desc[*seq_size],
665662 ctx_p->drvdata->mlli_sram_addr,
666663 req_ctx->in_mlli_nents, NS_BIT,
667664 (!areq ? 0 : 1));
668665 } else {
669− SSI_LOG_DEBUG(" din/dout params "
670− "addr 0x%08X addr 0x%08X\n",
666+ dev_dbg(dev, " din/dout params addr 0x%08X addr 0x%08X\n",
671667 (unsigned int)ctx_p->drvdata->mlli_sram_addr,
672668 (unsigned int)ctx_p->drvdata->mlli_sram_addr +
673− (u32)LLI_ENTRY_BYTE_SIZE *
674− req_ctx->in_nents);
669+ (u32)LLI_ENTRY_BYTE_SIZE * req_ctx->in_nents);
675670 set_dout_mlli(&desc[*seq_size],
676671 (ctx_p->drvdata->mlli_sram_addr +
677672 (LLI_ENTRY_BYTE_SIZE *
@@ -697,16 +692,10 @@ static int ssi_blkcipher_complete(struct device *dev, · 19 unmodified lines
697692 void __iomem *cc_base)
698693 {
699694 int completion_error = 0;
700− u32 inflight_counter;
701695 struct ablkcipher_request *req = (struct ablkcipher_request *)areq;
702696
703697 ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
704−
705− /*Set the inflight couter value to local variable*/
706− inflight_counter = ctx_p->drvdata->inflight_counter;
707− /*Decrease the inflight counter*/
708− if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
709− ctx_p->drvdata->inflight_counter--;
698+ kfree(req_ctx->iv);
710699
711700 if (areq) {
712701 /*
@@ -742,20 +731,20 @@ static int ssi_blkcipher_process( · 29 unmodified lines
742731 enum drv_crypto_direction direction)
743732 {
744733 struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
745− struct device *dev = &ctx_p->drvdata->plat_dev->dev;
734+ struct device *dev = drvdata_to_dev(ctx_p->drvdata);
746735 struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN];
747736 struct ssi_crypto_req ssi_req = {};
748737 int rc, seq_len = 0, cts_restore_flag = 0;
749738
750− SSI_LOG_DEBUG("%s areq=%p info=%p nbytes=%d\n",
751− ((direction == DRV_CRYPTO_DIRECTION_ENCRYPT) ? "Encrypt" : "Decrypt"),
752− areq, info, nbytes);
739+ dev_dbg(dev, "%s areq=%p info=%p nbytes=%d\n",
740+ ((direction == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
741+ "Encrypt" : "Decrypt"), areq, info, nbytes);
753742
754743 /* STAT_PHASE_0: Init and sanity checks */
755744
756745 /* TODO: check data length according to mode */
757746 if (unlikely(validate_data_size(ctx_p, nbytes))) {
758− SSI_LOG_ERR("Unsupported data size %d.\n", nbytes);
747+ dev_err(dev, "Unsupported data size %d.\n", nbytes);
759748 crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN);
760749 rc = -EINVAL;
761750 goto exit_process;
@@ -765,6 +754,17 @@ static int ssi_blkcipher_process( · 3 unmodified lines
765754 rc = 0;
766755 goto exit_process;
767756 }
757+
758+ /* The IV we are handed may be allocted from the stack so
759+ * we must copy it to a DMAable buffer before use.
760+ */
761+ req_ctx->iv = kmalloc(ivsize, GFP_KERNEL);
762+ if (!req_ctx->iv) {
763+ rc = -ENOMEM;
764+ goto exit_process;
765+ }
766+ memcpy(req_ctx->iv, info, ivsize);
767+
768768 /*For CTS in case of data size aligned to 16 use CBC mode*/
769769 if (((nbytes % AES_BLOCK_SIZE) == 0) && (ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS)) {
770770 ctx_p->cipher_mode = DRV_CIPHER_CBC;
@@ -786,9 +786,11 @@ static int ssi_blkcipher_process( · 15 unmodified lines
786786
787787 /* STAT_PHASE_1: Map buffers */
788788
789− rc = ssi_buffer_mgr_map_blkcipher_request(ctx_p->drvdata, req_ctx, ivsize, nbytes, info, src, dst);
789+ rc = ssi_buffer_mgr_map_blkcipher_request(ctx_p->drvdata, req_ctx,
790+ ivsize, nbytes, req_ctx->iv,
791+ src, dst);
790792 if (unlikely(rc != 0)) {
791− SSI_LOG_ERR("map_request() failed\n");
793+ dev_err(dev, "map_request() failed\n");
792794 goto exit_process;
793795 }
794796
@@ -838,8 +840,10 @@ exit_process: · 43 unmodified lines
838840 if (cts_restore_flag != 0)
839841 ctx_p->cipher_mode = DRV_CIPHER_CBC_CTS;
840842
841− if (rc != -EINPROGRESS)
843+ if (rc != -EINPROGRESS) {
842844 kfree(req_ctx->backup_info);
845+ kfree(req_ctx->iv);
846+ }
843847
844848 return rc;
845849 }
@@ -1245,16 +1249,15 @@ static struct ssi_alg_template blkcipher_algs[] = { · 399 unmodified lines
12451249 };
12461250
12471251 static
1248−struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *template)
1252+struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template
1253+ *template, struct device *dev)
12491254 {
12501255 struct ssi_crypto_alg *t_alg;
12511256 struct crypto_alg *alg;
12521257
12531258 t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL);
1254− if (!t_alg) {
1255− SSI_LOG_ERR("failed to allocate t_alg\n");
1259+ if (!t_alg)
12561260 return ERR_PTR(-ENOMEM);
1257− }
12581261
12591262 alg = &t_alg->crypto_alg;
12601263
@@ -1285,10 +1288,6 @@ int ssi_ablkcipher_free(struct ssi_drvdata *drvdata) · 24 unmodified lines
12851288 struct ssi_crypto_alg *t_alg, *n;
12861289 struct ssi_blkcipher_handle *blkcipher_handle =
12871290 drvdata->blkcipher_handle;
1288− struct device *dev;
1289−
1290− dev = &drvdata->plat_dev->dev;
1291−
12921291 if (blkcipher_handle) {
12931292 /* Remove registered algs */
12941293 list_for_each_entry_safe(t_alg, n,
@@ -1308,6 +1307,7 @@ int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata) · 13 unmodified lines
13081307 {
13091308 struct ssi_blkcipher_handle *ablkcipher_handle;
13101309 struct ssi_crypto_alg *t_alg;
1310+ struct device *dev = drvdata_to_dev(drvdata);
13111311 int rc = -ENOMEM;
13121312 int alg;
13131313
@@ -1315,37 +1315,38 @@ int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata) · 1 unmodified line
13151315 if (!ablkcipher_handle)
13161316 return -ENOMEM;
13171317
1318− drvdata->blkcipher_handle = ablkcipher_handle;
1319−
13201318 INIT_LIST_HEAD(&ablkcipher_handle->blkcipher_alg_list);
1319+ drvdata->blkcipher_handle = ablkcipher_handle;
13211320
13221321 /* Linux crypto */
1323− SSI_LOG_DEBUG("Number of algorithms = %zu\n", ARRAY_SIZE(blkcipher_algs));
1322+ dev_dbg(dev, "Number of algorithms = %zu\n",
1323+ ARRAY_SIZE(blkcipher_algs));
13241324 for (alg = 0; alg < ARRAY_SIZE(blkcipher_algs); alg++) {
1325− SSI_LOG_DEBUG("creating %s\n", blkcipher_algs[alg].driver_name);
1326− t_alg = ssi_ablkcipher_create_alg(&blkcipher_algs[alg]);
1325+ dev_dbg(dev, "creating %s\n", blkcipher_algs[alg].driver_name);
1326+ t_alg = ssi_ablkcipher_create_alg(&blkcipher_algs[alg], dev);
13271327 if (IS_ERR(t_alg)) {
13281328 rc = PTR_ERR(t_alg);
1329− SSI_LOG_ERR("%s alg allocation failed\n",
1330− blkcipher_algs[alg].driver_name);
1329+ dev_err(dev, "%s alg allocation failed\n",
1330+ blkcipher_algs[alg].driver_name);
13311331 goto fail0;
13321332 }
13331333 t_alg->drvdata = drvdata;
13341334
1335− SSI_LOG_DEBUG("registering %s\n", blkcipher_algs[alg].driver_name);
1335+ dev_dbg(dev, "registering %s\n",
1336+ blkcipher_algs[alg].driver_name);
13361337 rc = crypto_register_alg(&t_alg->crypto_alg);
1337− SSI_LOG_DEBUG("%s alg registration rc = %x\n",
1338− t_alg->crypto_alg.cra_driver_name, rc);
1338+ dev_dbg(dev, "%s alg registration rc = %x\n",
1339+ t_alg->crypto_alg.cra_driver_name, rc);
13391340 if (unlikely(rc != 0)) {
1340− SSI_LOG_ERR("%s alg registration failed\n",
1341− t_alg->crypto_alg.cra_driver_name);
1341+ dev_err(dev, "%s alg registration failed\n",
1342+ t_alg->crypto_alg.cra_driver_name);
13421343 kfree(t_alg);
13431344 goto fail0;
13441345 } else {
13451346 list_add_tail(&t_alg->entry,
13461347 &ablkcipher_handle->blkcipher_alg_list);
1347− SSI_LOG_DEBUG("Registered %s\n",
1348− t_alg->crypto_alg.cra_driver_name);
1348+ dev_dbg(dev, "Registered %s\n",
1349+ t_alg->crypto_alg.cra_driver_name);
13491350 }
13501351 }
13511352 return 0;
drivers/staging/ccree/ssi_cipher.h+7−6
@@ -27,11 +27,11 @@ · 26 unmodified lines
2727 #include "ssi_buffer_mgr.h"
2828
2929 /* Crypto cipher flags */
30−#define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0)
31−#define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1)
32−#define CC_CRYPTO_CIPHER_KEY_KFDE2 (1 << 2)
33−#define CC_CRYPTO_CIPHER_KEY_KFDE3 (1 << 3)
34−#define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4)
30+#define CC_CRYPTO_CIPHER_KEY_KFDE0 BIT(0)
31+#define CC_CRYPTO_CIPHER_KEY_KFDE1 BIT(1)
32+#define CC_CRYPTO_CIPHER_KEY_KFDE2 BIT(2)
33+#define CC_CRYPTO_CIPHER_KEY_KFDE3 BIT(3)
34+#define CC_CRYPTO_CIPHER_DU_SIZE_512B BIT(4)
3535
3636 #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3)
3737
@@ -43,6 +43,7 @@ struct blkcipher_req_ctx { · 5 unmodified lines
4343 u32 out_nents;
4444 u32 out_mlli_nents;
4545 u8 *backup_info; /*store iv for generated IV flow*/
46+ u8 *iv;
4647 bool is_giv;
4748 struct mlli_params mlli_params;
4849 };
@@ -75,7 +76,7 @@ struct arm_hw_key_info { · 26 unmodified lines
7576
7677 static inline bool ssi_is_hw_key(struct crypto_tfm *tfm)
7778 {
78− return 0;
79+ return false;
7980 }
8081
8182 #endif /* CRYPTO_TFM_REQ_HW_KEY */
drivers/staging/ccree/ssi_driver.c+165−216
@@ -74,70 +74,46 @@ · 73 unmodified lines
7474 #include "ssi_fips.h"
7575
7676 #ifdef DX_DUMP_BYTES
77−void dump_byte_array(const char *name, const u8 *the_array, unsigned long size)
77+void dump_byte_array(const char *name, const u8 *buf, size_t len)
7878 {
79− int i, line_offset = 0, ret = 0;
80− const u8 *cur_byte;
81− char line_buf[80];
79+ char prefix[NAME_LEN];
8280
83− if (!the_array) {
84− SSI_LOG_ERR("cannot dump array - NULL pointer\n");
81+ if (!buf)
8582 return;
86− }
8783
88− ret = snprintf(line_buf, sizeof(line_buf), "%s[%lu]: ", name, size);
89− if (ret < 0) {
90− SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret);
91− return;
92− }
93− line_offset = ret;
94− for (i = 0, cur_byte = the_array;
95− (i < size) && (line_offset < sizeof(line_buf)); i++, cur_byte++) {
96− ret = snprintf(line_buf + line_offset,
97− sizeof(line_buf) - line_offset,
98− "0x%02X ", *cur_byte);
99− if (ret < 0) {
100− SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret);
101− return;
102− }
103− line_offset += ret;
104− if (line_offset > 75) { /* Cut before line end */
105− SSI_LOG_DEBUG("%s\n", line_buf);
106− line_offset = 0;
107− }
108− }
84+ snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
10985
110− if (line_offset > 0) /* Dump remaining line */
111− SSI_LOG_DEBUG("%s\n", line_buf);
86+ print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_ADDRESS, 16, 1, len,
87+ false);
11288 }
11389 #endif
11490
11591 static irqreturn_t cc_isr(int irq, void *dev_id)
11692 {
11793 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)dev_id;
118− void __iomem *cc_base = drvdata->cc_base;
94+ struct device *dev = drvdata_to_dev(drvdata);
11995 u32 irr;
12096 u32 imr;
12197
12298 /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */
12399
124100 /* read the interrupt status */
125− irr = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR));
126− SSI_LOG_DEBUG("Got IRR=0x%08X\n", irr);
101+ irr = cc_ioread(drvdata, CC_REG(HOST_IRR));
102+ dev_dbg(dev, "Got IRR=0x%08X\n", irr);
127103 if (unlikely(irr == 0)) { /* Probably shared interrupt line */
128− SSI_LOG_ERR("Got interrupt with empty IRR\n");
104+ dev_err(dev, "Got interrupt with empty IRR\n");
129105 return IRQ_NONE;
130106 }
131− imr = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR));
107+ imr = cc_ioread(drvdata, CC_REG(HOST_IMR));
132108
133109 /* clear interrupt - must be before processing events */
134− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), irr);
110+ cc_iowrite(drvdata, CC_REG(HOST_ICR), irr);
135111
136112 drvdata->irq = irr;
137113 /* Completion interrupt - most probable */
138114 if (likely((irr & SSI_COMP_IRQ_MASK) != 0)) {
139115 /* Mask AXI completion interrupt - will be unmasked in Deferred service handler */
140− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), imr | SSI_COMP_IRQ_MASK);
116+ cc_iowrite(drvdata, CC_REG(HOST_IMR), imr | SSI_COMP_IRQ_MASK);
141117 irr &= ~SSI_COMP_IRQ_MASK;
142118 complete_request(drvdata);
143119 }
@@ -145,7 +121,7 @@ static irqreturn_t cc_isr(int irq, void *dev_id) · 1 unmodified line
145121 /* TEE FIPS interrupt */
146122 if (likely((irr & SSI_GPR0_IRQ_MASK) != 0)) {
147123 /* Mask interrupt - will be unmasked in Deferred service handler */
148− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), imr | SSI_GPR0_IRQ_MASK);
124+ cc_iowrite(drvdata, CC_REG(HOST_IMR), imr | SSI_GPR0_IRQ_MASK);
149125 irr &= ~SSI_GPR0_IRQ_MASK;
150126 fips_handler(drvdata);
151127 }
@@ -155,14 +131,16 @@ static irqreturn_t cc_isr(int irq, void *dev_id) · 3 unmodified lines
155131 u32 axi_err;
156132
157133 /* Read the AXI error ID */
158− axi_err = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR));
159− SSI_LOG_DEBUG("AXI completion error: axim_mon_err=0x%08X\n", axi_err);
134+ axi_err = cc_ioread(drvdata, CC_REG(AXIM_MON_ERR));
135+ dev_dbg(dev, "AXI completion error: axim_mon_err=0x%08X\n",
136+ axi_err);
160137
161138 irr &= ~SSI_AXI_ERR_IRQ_MASK;
162139 }
163140
164141 if (unlikely(irr != 0)) {
165− SSI_LOG_DEBUG("IRR includes unknown cause bits (0x%08X)\n", irr);
142+ dev_dbg(dev, "IRR includes unknown cause bits (0x%08X)\n",
143+ irr);
166144 /* Just warning */
167145 }
168146
@@ -172,48 +150,48 @@ static irqreturn_t cc_isr(int irq, void *dev_id) · 3 unmodified lines
172150 int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe)
173151 {
174152 unsigned int val, cache_params;
175− void __iomem *cc_base = drvdata->cc_base;
153+ struct device *dev = drvdata_to_dev(drvdata);
176154
177155 /* Unmask all AXI interrupt sources AXI_CFG1 register */
178− val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG));
179− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG), val & ~SSI_AXI_IRQ_MASK);
180− SSI_LOG_DEBUG("AXIM_CFG=0x%08X\n", CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG)));
156+ val = cc_ioread(drvdata, CC_REG(AXIM_CFG));
157+ cc_iowrite(drvdata, CC_REG(AXIM_CFG), val & ~SSI_AXI_IRQ_MASK);
158+ dev_dbg(dev, "AXIM_CFG=0x%08X\n",
159+ cc_ioread(drvdata, CC_REG(AXIM_CFG)));
181160
182161 /* Clear all pending interrupts */
183− val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR));
184− SSI_LOG_DEBUG("IRR=0x%08X\n", val);
185− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), val);
162+ val = cc_ioread(drvdata, CC_REG(HOST_IRR));
163+ dev_dbg(dev, "IRR=0x%08X\n", val);
164+ cc_iowrite(drvdata, CC_REG(HOST_ICR), val);
186165
187166 /* Unmask relevant interrupt cause */
188− val = (~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | SSI_GPR0_IRQ_MASK));
189− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), val);
167+ val = (unsigned int)(~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK |
168+ SSI_GPR0_IRQ_MASK));
169+ cc_iowrite(drvdata, CC_REG(HOST_IMR), val);
190170
191171 #ifdef DX_HOST_IRQ_TIMER_INIT_VAL_REG_OFFSET
192172 #ifdef DX_IRQ_DELAY
193173 /* Set CC IRQ delay */
194− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRQ_TIMER_INIT_VAL),
195− DX_IRQ_DELAY);
174+ cc_iowrite(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL), DX_IRQ_DELAY);
196175 #endif
197− if (CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRQ_TIMER_INIT_VAL)) > 0) {
198− SSI_LOG_DEBUG("irq_delay=%d CC cycles\n",
199− CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRQ_TIMER_INIT_VAL)));
176+ if (cc_ioread(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL)) > 0) {
177+ dev_dbg(dev, "irq_delay=%d CC cycles\n",
178+ cc_ioread(drvdata, CC_REG(HOST_IRQ_TIMER_INIT_VAL)));
200179 }
201180 #endif
202181
203182 cache_params = (drvdata->coherent ? CC_COHERENT_CACHE_PARAMS : 0x0);
204183
205− val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS));
184+ val = cc_ioread(drvdata, CC_REG(AXIM_CACHE_PARAMS));
206185
207186 if (is_probe)
208− SSI_LOG_INFO("Cache params previous: 0x%08X\n", val);
187+ dev_info(dev, "Cache params previous: 0x%08X\n", val);
209188
210− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS),
211− cache_params);
212− val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CACHE_PARAMS));
189+ cc_iowrite(drvdata, CC_REG(AXIM_CACHE_PARAMS), cache_params);
190+ val = cc_ioread(drvdata, CC_REG(AXIM_CACHE_PARAMS));
213191
214192 if (is_probe)
215− SSI_LOG_INFO("Cache params current: 0x%08X (expect: 0x%08X)\n",
216− val, cache_params);
193+ dev_info(dev, "Cache params current: 0x%08X (expect: 0x%08X)\n",
194+ val, cache_params);
217195
218196 return 0;
219197 }
@@ -222,181 +200,172 @@ static int init_cc_resources(struct platform_device *plat_dev) · 2 unmodified lines
222200 {
223201 struct resource *req_mem_cc_regs = NULL;
224202 void __iomem *cc_base = NULL;
225− bool irq_registered = false;
226− struct ssi_drvdata *new_drvdata = kzalloc(sizeof(*new_drvdata),
227− GFP_KERNEL);
203+ struct ssi_drvdata *new_drvdata;
228204 struct device *dev = &plat_dev->dev;
229205 struct device_node *np = dev->of_node;
230206 u32 signature_val;
207+ dma_addr_t dma_mask;
231208 int rc = 0;
232209
233− if (unlikely(!new_drvdata)) {
234− SSI_LOG_ERR("Failed to allocate drvdata");
235− rc = -ENOMEM;
236− goto init_cc_res_err;
237− }
210+ new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
211+ if (!new_drvdata)
212+ return -ENOMEM;
213+
214+ platform_set_drvdata(plat_dev, new_drvdata);
215+ new_drvdata->plat_dev = plat_dev;
238216
239217 new_drvdata->clk = of_clk_get(np, 0);
240218 new_drvdata->coherent = of_dma_is_coherent(np);
241219
242− /*Initialize inflight counter used in dx_ablkcipher_secure_complete used for count of BYSPASS blocks operations*/
243− new_drvdata->inflight_counter = 0;
244−
245− dev_set_drvdata(&plat_dev->dev, new_drvdata);
246220 /* Get device resources */
247221 /* First CC registers space */
248− new_drvdata->res_mem = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
249− if (unlikely(!new_drvdata->res_mem)) {
250− SSI_LOG_ERR("Failed getting IO memory resource\n");
251− rc = -ENODEV;
252− goto init_cc_res_err;
253− }
254− SSI_LOG_DEBUG("Got MEM resource (%s): start=%pad end=%pad\n",
255− new_drvdata->res_mem->name,
256− new_drvdata->res_mem->start,
257− new_drvdata->res_mem->end);
222+ req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
258223 /* Map registers space */
259− req_mem_cc_regs = request_mem_region(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem), "arm_cc7x_regs");
260− if (unlikely(!req_mem_cc_regs)) {
261− SSI_LOG_ERR("Couldn't allocate registers memory region at "
262− "0x%08X\n", (unsigned int)new_drvdata->res_mem->start);
263− rc = -EBUSY;
264− goto init_cc_res_err;
224+ new_drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
225+ if (IS_ERR(new_drvdata->cc_base)) {
226+ dev_err(dev, "Failed to ioremap registers");
227+ return PTR_ERR(new_drvdata->cc_base);
265228 }
266− cc_base = ioremap(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem));
267− if (unlikely(!cc_base)) {
268− SSI_LOG_ERR("ioremap[CC](0x%08X,0x%08X) failed\n",
269− (unsigned int)new_drvdata->res_mem->start,
270− (unsigned int)resource_size(new_drvdata->res_mem));
271− rc = -ENOMEM;
272− goto init_cc_res_err;
273− }
274− SSI_LOG_DEBUG("CC registers mapped from %pa to 0x%p\n", &new_drvdata->res_mem->start, cc_base);
275− new_drvdata->cc_base = cc_base;
229+
230+ dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name,
231+ req_mem_cc_regs);
232+ dev_dbg(dev, "CC registers mapped from %pa to 0x%p\n",
233+ &req_mem_cc_regs->start, new_drvdata->cc_base);
234+
235+ cc_base = new_drvdata->cc_base;
276236
277237 /* Then IRQ */
278− new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0);
279− if (unlikely(!new_drvdata->res_irq)) {
280− SSI_LOG_ERR("Failed getting IRQ resource\n");
281− rc = -ENODEV;
282− goto init_cc_res_err;
283− }
284− rc = request_irq(new_drvdata->res_irq->start, cc_isr,
285− IRQF_SHARED, "arm_cc7x", new_drvdata);
286− if (unlikely(rc != 0)) {
287− SSI_LOG_ERR("Could not register to interrupt %llu\n",
288− (unsigned long long)new_drvdata->res_irq->start);
289− goto init_cc_res_err;
238+ new_drvdata->irq = platform_get_irq(plat_dev, 0);
239+ if (new_drvdata->irq < 0) {
240+ dev_err(dev, "Failed getting IRQ resource\n");
241+ return new_drvdata->irq;
290242 }
291− init_completion(&new_drvdata->icache_setup_completion);
292243
293− irq_registered = true;
294− SSI_LOG_DEBUG("Registered to IRQ (%s) %llu\n",
295− new_drvdata->res_irq->name,
296− (unsigned long long)new_drvdata->res_irq->start);
244+ rc = devm_request_irq(dev, new_drvdata->irq, cc_isr,
245+ IRQF_SHARED, "arm_cc7x", new_drvdata);
246+ if (rc) {
247+ dev_err(dev, "Could not register to interrupt %d\n",
248+ new_drvdata->irq);
249+ return rc;
250+ }
251+ dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
297252
298− new_drvdata->plat_dev = plat_dev;
253+ if (!plat_dev->dev.dma_mask)
254+ plat_dev->dev.dma_mask = &plat_dev->dev.coherent_dma_mask;
299255
300− rc = cc_clk_on(new_drvdata);
301− if (rc)
302− goto init_cc_res_err;
256+ dma_mask = (dma_addr_t)(DMA_BIT_MASK(DMA_BIT_MASK_LEN));
257+ while (dma_mask > 0x7fffffffUL) {
258+ if (dma_supported(&plat_dev->dev, dma_mask)) {
259+ rc = dma_set_coherent_mask(&plat_dev->dev, dma_mask);
260+ if (!rc)
261+ break;
262+ }
263+ dma_mask >>= 1;
264+ }
303265
304− if (!new_drvdata->plat_dev->dev.dma_mask)
305− new_drvdata->plat_dev->dev.dma_mask = &new_drvdata->plat_dev->dev.coherent_dma_mask;
266+ if (rc) {
267+ dev_err(dev, "Failed in dma_set_mask, mask=%par\n",
268+ &dma_mask);
269+ return rc;
270+ }
306271
307− if (!new_drvdata->plat_dev->dev.coherent_dma_mask)
308− new_drvdata->plat_dev->dev.coherent_dma_mask = DMA_BIT_MASK(DMA_BIT_MASK_LEN);
272+ rc = cc_clk_on(new_drvdata);
273+ if (rc) {
274+ dev_err(dev, "Failed to enable clock");
275+ return rc;
276+ }
309277
310278 /* Verify correct mapping */
311− signature_val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_SIGNATURE));
279+ signature_val = cc_ioread(new_drvdata, CC_REG(HOST_SIGNATURE));
312280 if (signature_val != DX_DEV_SIGNATURE) {
313− SSI_LOG_ERR("Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n",
314− signature_val, (u32)DX_DEV_SIGNATURE);
281+ dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n",
282+ signature_val, (u32)DX_DEV_SIGNATURE);
315283 rc = -EINVAL;
316− goto init_cc_res_err;
284+ goto post_clk_err;
317285 }
318− SSI_LOG_DEBUG("CC SIGNATURE=0x%08X\n", signature_val);
286+ dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val);
319287
320288 /* Display HW versions */
321− SSI_LOG(KERN_INFO, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", SSI_DEV_NAME_STR,
322− CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_VERSION)), DRV_MODULE_VERSION);
289+ dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n",
290+ SSI_DEV_NAME_STR,
291+ cc_ioread(new_drvdata, CC_REG(HOST_VERSION)),
292+ DRV_MODULE_VERSION);
323293
324294 rc = init_cc_regs(new_drvdata, true);
325295 if (unlikely(rc != 0)) {
326− SSI_LOG_ERR("init_cc_regs failed\n");
327− goto init_cc_res_err;
296+ dev_err(dev, "init_cc_regs failed\n");
297+ goto post_clk_err;
328298 }
329299
330300 #ifdef ENABLE_CC_SYSFS
331− rc = ssi_sysfs_init(&plat_dev->dev.kobj, new_drvdata);
301+ rc = ssi_sysfs_init(&dev->kobj, new_drvdata);
332302 if (unlikely(rc != 0)) {
333− SSI_LOG_ERR("init_stat_db failed\n");
334− goto init_cc_res_err;
303+ dev_err(dev, "init_stat_db failed\n");
304+ goto post_regs_err;
335305 }
336306 #endif
337307
308+ rc = ssi_fips_init(new_drvdata);
309+ if (unlikely(rc != 0)) {
310+ dev_err(dev, "SSI_FIPS_INIT failed 0x%x\n", rc);
311+ goto post_sysfs_err;
312+ }
338313 rc = ssi_sram_mgr_init(new_drvdata);
339314 if (unlikely(rc != 0)) {
340− SSI_LOG_ERR("ssi_sram_mgr_init failed\n");
341− goto init_cc_res_err;
315+ dev_err(dev, "ssi_sram_mgr_init failed\n");
316+ goto post_fips_init_err;
342317 }
343318
344319 new_drvdata->mlli_sram_addr =
345320 ssi_sram_mgr_alloc(new_drvdata, MAX_MLLI_BUFF_SIZE);
346321 if (unlikely(new_drvdata->mlli_sram_addr == NULL_SRAM_ADDR)) {
347− SSI_LOG_ERR("Failed to alloc MLLI Sram buffer\n");
322+ dev_err(dev, "Failed to alloc MLLI Sram buffer\n");
348323 rc = -ENOMEM;
349− goto init_cc_res_err;
324+ goto post_sram_mgr_err;
350325 }
351326
352327 rc = request_mgr_init(new_drvdata);
353328 if (unlikely(rc != 0)) {
354− SSI_LOG_ERR("request_mgr_init failed\n");
355− goto init_cc_res_err;
329+ dev_err(dev, "request_mgr_init failed\n");
330+ goto post_sram_mgr_err;
356331 }
357332
358333 rc = ssi_buffer_mgr_init(new_drvdata);
359334 if (unlikely(rc != 0)) {
360− SSI_LOG_ERR("buffer_mgr_init failed\n");
361− goto init_cc_res_err;
335+ dev_err(dev, "buffer_mgr_init failed\n");
336+ goto post_req_mgr_err;
362337 }
363338
364339 rc = ssi_power_mgr_init(new_drvdata);
365340 if (unlikely(rc != 0)) {
366− SSI_LOG_ERR("ssi_power_mgr_init failed\n");
367− goto init_cc_res_err;
368− }
369−
370− rc = ssi_fips_init(new_drvdata);
371− if (unlikely(rc != 0)) {
372− SSI_LOG_ERR("SSI_FIPS_INIT failed 0x%x\n", rc);
373− goto init_cc_res_err;
341+ dev_err(dev, "ssi_power_mgr_init failed\n");
342+ goto post_buf_mgr_err;
374343 }
375344
376345 rc = ssi_ivgen_init(new_drvdata);
377346 if (unlikely(rc != 0)) {
378− SSI_LOG_ERR("ssi_ivgen_init failed\n");
379− goto init_cc_res_err;
347+ dev_err(dev, "ssi_ivgen_init failed\n");
348+ goto post_power_mgr_err;
380349 }
381350
382351 /* Allocate crypto algs */
383352 rc = ssi_ablkcipher_alloc(new_drvdata);
384353 if (unlikely(rc != 0)) {
385− SSI_LOG_ERR("ssi_ablkcipher_alloc failed\n");
386− goto init_cc_res_err;
354+ dev_err(dev, "ssi_ablkcipher_alloc failed\n");
355+ goto post_ivgen_err;
387356 }
388357
389358 /* hash must be allocated before aead since hash exports APIs */
390359 rc = ssi_hash_alloc(new_drvdata);
391360 if (unlikely(rc != 0)) {
392− SSI_LOG_ERR("ssi_hash_alloc failed\n");
393− goto init_cc_res_err;
361+ dev_err(dev, "ssi_hash_alloc failed\n");
362+ goto post_cipher_err;
394363 }
395364
396365 rc = ssi_aead_alloc(new_drvdata);
397366 if (unlikely(rc != 0)) {
398− SSI_LOG_ERR("ssi_aead_alloc failed\n");
399− goto init_cc_res_err;
367+ dev_err(dev, "ssi_aead_alloc failed\n");
368+ goto post_hash_err;
400369 }
401370
402371 /* If we got here and FIPS mode is enabled
@@ -407,52 +376,43 @@ static int init_cc_resources(struct platform_device *plat_dev) · 4 unmodified lines
407376
408377 return 0;
409378
410−init_cc_res_err:
411− SSI_LOG_ERR("Freeing CC HW resources!\n");
412−
413− if (new_drvdata) {
414− ssi_aead_free(new_drvdata);
415− ssi_hash_free(new_drvdata);
416− ssi_ablkcipher_free(new_drvdata);
417− ssi_ivgen_fini(new_drvdata);
418− ssi_power_mgr_fini(new_drvdata);
419− ssi_buffer_mgr_fini(new_drvdata);
420− request_mgr_fini(new_drvdata);
421− ssi_sram_mgr_fini(new_drvdata);
422− ssi_fips_fini(new_drvdata);
379+post_hash_err:
380+ ssi_hash_free(new_drvdata);
381+post_cipher_err:
382+ ssi_ablkcipher_free(new_drvdata);
383+post_ivgen_err:
384+ ssi_ivgen_fini(new_drvdata);
385+post_power_mgr_err:
386+ ssi_power_mgr_fini(new_drvdata);
387+post_buf_mgr_err:
388+ ssi_buffer_mgr_fini(new_drvdata);
389+post_req_mgr_err:
390+ request_mgr_fini(new_drvdata);
391+post_sram_mgr_err:
392+ ssi_sram_mgr_fini(new_drvdata);
393+post_fips_init_err:
394+ ssi_fips_fini(new_drvdata);
395+post_sysfs_err:
423396 #ifdef ENABLE_CC_SYSFS
424− ssi_sysfs_fini();
397+ ssi_sysfs_fini();
425398 #endif
426−
427− if (req_mem_cc_regs) {
428− if (irq_registered) {
429− free_irq(new_drvdata->res_irq->start, new_drvdata);
430− new_drvdata->res_irq = NULL;
431− iounmap(cc_base);
432− new_drvdata->cc_base = NULL;
433− }
434− release_mem_region(new_drvdata->res_mem->start,
435− resource_size(new_drvdata->res_mem));
436− new_drvdata->res_mem = NULL;
437− }
438− kfree(new_drvdata);
439− dev_set_drvdata(&plat_dev->dev, NULL);
440− }
441−
399+post_regs_err:
400+ fini_cc_regs(new_drvdata);
401+post_clk_err:
402+ cc_clk_off(new_drvdata);
442403 return rc;
443404 }
444405
445406 void fini_cc_regs(struct ssi_drvdata *drvdata)
446407 {
447408 /* Mask all interrupts */
448− WRITE_REGISTER(drvdata->cc_base +
449− CC_REG_OFFSET(HOST_RGF, HOST_IMR), 0xFFFFFFFF);
409+ cc_iowrite(drvdata, CC_REG(HOST_IMR), 0xFFFFFFFF);
450410 }
451411
452412 static void cleanup_cc_resources(struct platform_device *plat_dev)
453413 {
454414 struct ssi_drvdata *drvdata =
455− (struct ssi_drvdata *)dev_get_drvdata(&plat_dev->dev);
415+ (struct ssi_drvdata *)platform_get_drvdata(plat_dev);
456416
457417 ssi_aead_free(drvdata);
458418 ssi_hash_free(drvdata);
@@ -466,22 +426,8 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) · 7 unmodified lines
466426 #ifdef ENABLE_CC_SYSFS
467427 ssi_sysfs_fini();
468428 #endif
469−
470429 fini_cc_regs(drvdata);
471430 cc_clk_off(drvdata);
472− free_irq(drvdata->res_irq->start, drvdata);
473− drvdata->res_irq = NULL;
474−
475− if (drvdata->cc_base) {
476− iounmap(drvdata->cc_base);
477− release_mem_region(drvdata->res_mem->start,
478− resource_size(drvdata->res_mem));
479− drvdata->cc_base = NULL;
480− drvdata->res_mem = NULL;
481− }
482−
483− kfree(drvdata);
484− dev_set_drvdata(&plat_dev->dev, NULL);
485431 }
486432
487433 int cc_clk_on(struct ssi_drvdata *drvdata)
@@ -514,18 +460,19 @@ void cc_clk_off(struct ssi_drvdata *drvdata) · 26 unmodified lines
514460 static int cc7x_probe(struct platform_device *plat_dev)
515461 {
516462 int rc;
463+ struct device *dev = &plat_dev->dev;
517464 #if defined(CONFIG_ARM) && defined(CC_DEBUG)
518465 u32 ctr, cacheline_size;
519466
520467 asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
521468 cacheline_size = 4 << ((ctr >> 16) & 0xf);
522− SSI_LOG_DEBUG("CP15(L1_CACHE_BYTES) = %u , Kconfig(L1_CACHE_BYTES) = %u\n",
523− cacheline_size, L1_CACHE_BYTES);
469+ dev_dbg(dev, "CP15(L1_CACHE_BYTES) = %u , Kconfig(L1_CACHE_BYTES) = %u\n",
470+ cacheline_size, L1_CACHE_BYTES);
524471
525472 asm volatile("mrc p15, 0, %0, c0, c0, 0" : "=r" (ctr));
526− SSI_LOG_DEBUG("Main ID register (MIDR): Implementer 0x%02X, Arch 0x%01X, Part 0x%03X, Rev r%dp%d\n",
527− (ctr >> 24), (ctr >> 16) & 0xF, (ctr >> 4) & 0xFFF,
528− (ctr >> 20) & 0xF, ctr & 0xF);
473+ dev_dbg(dev, "Main ID register (MIDR): Implementer 0x%02X, Arch 0x%01X, Part 0x%03X, Rev r%dp%d\n",
474+ (ctr >> 24), (ctr >> 16) & 0xF, (ctr >> 4) & 0xFFF,
475+ (ctr >> 20) & 0xF, ctr & 0xF);
529476 #endif
530477
531478 /* Map registers space */
@@ -533,18 +480,20 @@ static int cc7x_probe(struct platform_device *plat_dev) · 1 unmodified line
533480 if (rc != 0)
534481 return rc;
535482
536− SSI_LOG(KERN_INFO, "ARM cc7x_ree device initialized\n");
483+ dev_info(dev, "ARM ccree device initialized\n");
537484
538485 return 0;
539486 }
540487
541488 static int cc7x_remove(struct platform_device *plat_dev)
542489 {
543− SSI_LOG_DEBUG("Releasing cc7x resources...\n");
490+ struct device *dev = &plat_dev->dev;
491+
492+ dev_dbg(dev, "Releasing cc7x resources...\n");
544493
545494 cleanup_cc_resources(plat_dev);
546495
547− SSI_LOG(KERN_INFO, "ARM cc7x_ree device terminated\n");
496+ dev_info(dev, "ARM ccree device terminated\n");
548497
549498 return 0;
550499 }
drivers/staging/ccree/ssi_driver.h+29−26
@@ -37,13 +37,11 @@ · 36 unmodified lines
3737 #include <crypto/hash.h>
3838 #include <linux/version.h>
3939 #include <linux/clk.h>
40+#include <linux/platform_device.h>
4041
4142 /* Registers definitions from shared/hw/ree_include */
42−#include "dx_reg_base_host.h"
4343 #include "dx_host.h"
44−#include "cc_regs.h"
4544 #include "dx_reg_common.h"
46−#include "cc_hal.h"
4745 #define CC_SUPPORT_SHA DX_DEV_SHA_MAX
4846 #include "cc_crypto_ctx.h"
4947 #include "ssi_sysfs.h"
@@ -68,12 +66,19 @@ · 18 unmodified lines
6866 #define SSI_AXI_IRQ_MASK ((1 << DX_AXIM_CFG_BRESPMASK_BIT_SHIFT) | (1 << DX_AXIM_CFG_RRESPMASK_BIT_SHIFT) | \
6967 (1 << DX_AXIM_CFG_INFLTMASK_BIT_SHIFT) | (1 << DX_AXIM_CFG_COMPMASK_BIT_SHIFT))
7068
71−#define SSI_AXI_ERR_IRQ_MASK (1 << DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT)
69+#define SSI_AXI_ERR_IRQ_MASK BIT(DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT)
7270
73−#define SSI_COMP_IRQ_MASK (1 << DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT)
71+#define SSI_COMP_IRQ_MASK BIT(DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT)
72+
73+#define AXIM_MON_COMP_VALUE GENMASK(DX_AXIM_MON_COMP_VALUE_BIT_SIZE + \
74+ DX_AXIM_MON_COMP_VALUE_BIT_SHIFT, \
75+ DX_AXIM_MON_COMP_VALUE_BIT_SHIFT)
76+
77+/* Register name mangling macro */
78+#define CC_REG(reg_name) DX_ ## reg_name ## _REG_OFFSET
7479
7580 /* TEE FIPS status interrupt */
76−#define SSI_GPR0_IRQ_MASK (1 << DX_HOST_IRR_GPR0_BIT_SHIFT)
81+#define SSI_GPR0_IRQ_MASK BIT(DX_HOST_IRR_GPR0_BIT_SHIFT)
7782
7883 #define SSI_CRA_PRIO 3000
7984
@@ -90,19 +95,6 @@ · 10 unmodified lines
9095 * field in the HW descriptor. The DMA engine +8 that value.
9196 */
9297
93−/* Logging macros */
94−#define SSI_LOG(level, format, ...) \
95− printk(level "cc715ree::%s: " format, __func__, ##__VA_ARGS__)
96−#define SSI_LOG_ERR(format, ...) SSI_LOG(KERN_ERR, format, ##__VA_ARGS__)
97−#define SSI_LOG_WARNING(format, ...) SSI_LOG(KERN_WARNING, format, ##__VA_ARGS__)
98−#define SSI_LOG_NOTICE(format, ...) SSI_LOG(KERN_NOTICE, format, ##__VA_ARGS__)
99−#define SSI_LOG_INFO(format, ...) SSI_LOG(KERN_INFO, format, ##__VA_ARGS__)
100−#ifdef CC_DEBUG
101−#define SSI_LOG_DEBUG(format, ...) SSI_LOG(KERN_DEBUG, format, ##__VA_ARGS__)
102−#else /* Debug log messages are removed at compile time for non-DEBUG config. */
103−#define SSI_LOG_DEBUG(format, ...) do {} while (0)
104−#endif
105−
10698 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
10799 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
108100
@@ -128,10 +120,8 @@ struct ssi_crypto_req { · 19 unmodified lines
128120 * @fw_ver: SeP loaded firmware version
129121 */
130122 struct ssi_drvdata {
131− struct resource *res_mem;
132− struct resource *res_irq;
133123 void __iomem *cc_base;
134− unsigned int irq;
124+ int irq;
135125 u32 irq_mask;
136126 u32 fw_ver;
137127 /* Calibration time of start/stop
@@ -140,7 +130,6 @@ struct ssi_drvdata { · 2 unmodified lines
140130 u32 monitor_null_cycles;
141131 struct platform_device *plat_dev;
142132 ssi_sram_addr_t mlli_sram_addr;
143− struct completion icache_setup_completion;
144133 void *buff_mgr_handle;
145134 void *hash_handle;
146135 void *aead_handle;
@@ -149,7 +138,6 @@ struct ssi_drvdata { · 2 unmodified lines
149138 void *fips_handle;
150139 void *ivgen_handle;
151140 void *sram_mgr_handle;
152− u32 inflight_counter;
153141 struct clk *clk;
154142 bool coherent;
155143 };
@@ -187,11 +175,16 @@ struct async_gen_req_ctx { · 31 unmodified lines
187175 enum drv_crypto_direction op_type;
188176 };
189177
178+static inline struct device *drvdata_to_dev(struct ssi_drvdata *drvdata)
179+{
180+ return &drvdata->plat_dev->dev;
181+}
182+
190183 #ifdef DX_DUMP_BYTES
191184 void dump_byte_array(const char *name, const u8 *the_array, unsigned long size);
192185 #else
193−#define dump_byte_array(name, array, size) do { \
194−} while (0);
186+static inline void dump_byte_array(const char *name, const u8 *the_array,
187+ unsigned long size) {};
195188 #endif
196189
197190 int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe);
@@ -199,5 +192,15 @@ void fini_cc_regs(struct ssi_drvdata *drvdata); · 1 unmodified line
199192 int cc_clk_on(struct ssi_drvdata *drvdata);
200193 void cc_clk_off(struct ssi_drvdata *drvdata);
201194
195+static inline void cc_iowrite(struct ssi_drvdata *drvdata, u32 reg, u32 val)
196+{
197+ iowrite32(val, (drvdata->cc_base + reg));
198+}
199+
200+static inline u32 cc_ioread(struct ssi_drvdata *drvdata, u32 reg)
201+{
202+ return ioread32(drvdata->cc_base + reg);
203+}
204+
202205 #endif /*__SSI_DRIVER_H__*/
203206
drivers/staging/ccree/ssi_fips.c+12−14
@@ -19,7 +19,6 @@ · 18 unmodified lines
1919
2020 #include "ssi_config.h"
2121 #include "ssi_driver.h"
22−#include "cc_hal.h"
2322 #include "ssi_fips.h"
2423
2524 static void fips_dsr(unsigned long devarg);
@@ -34,9 +33,8 @@ struct ssi_fips_handle { · 8 unmodified lines
3433 static bool cc_get_tee_fips_status(struct ssi_drvdata *drvdata)
3534 {
3635 u32 reg;
37− void __iomem *cc_base = drvdata->cc_base;
3836
39− reg = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST));
37+ reg = cc_ioread(drvdata, CC_REG(GPR_HOST));
4038 return (reg == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK));
4139 }
4240
@@ -46,12 +44,11 @@ static bool cc_get_tee_fips_status(struct ssi_drvdata *drvdata) · 3 unmodified lines
4644 */
4745 void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool status)
4846 {
49− void __iomem *cc_base = drvdata->cc_base;
5047 int val = CC_FIPS_SYNC_REE_STATUS;
5148
5249 val |= (status ? CC_FIPS_SYNC_MODULE_OK : CC_FIPS_SYNC_MODULE_ERROR);
5350
54− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_GPR0), val);
51+ cc_iowrite(drvdata, CC_REG(HOST_GPR0), val);
5552 }
5653
5754 void ssi_fips_fini(struct ssi_drvdata *drvdata)
@@ -76,41 +73,42 @@ void fips_handler(struct ssi_drvdata *drvdata) · 18 unmodified lines
7673 tasklet_schedule(&fips_handle_ptr->tasklet);
7774 }
7875
79−static inline void tee_fips_error(void)
76+static inline void tee_fips_error(struct device *dev)
8077 {
8178 if (fips_enabled)
8279 panic("ccree: TEE reported cryptographic error in fips mode!\n");
8380 else
84− SSI_LOG_ERR("TEE reported error!\n");
81+ dev_err(dev, "TEE reported error!\n");
8582 }
8683
8784 /* Deferred service handler, run as interrupt-fired tasklet */
8885 static void fips_dsr(unsigned long devarg)
8986 {
9087 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg;
91− void __iomem *cc_base = drvdata->cc_base;
88+ struct device *dev = drvdata_to_dev(drvdata);
9289 u32 irq, state, val;
9390
9491 irq = (drvdata->irq & (SSI_GPR0_IRQ_MASK));
9592
9693 if (irq) {
97− state = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, GPR_HOST));
94+ state = cc_ioread(drvdata, CC_REG(GPR_HOST));
9895
9996 if (state != (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK))
100− tee_fips_error();
97+ tee_fips_error(dev);
10198 }
10299
103100 /* after verifing that there is nothing to do,
104101 * unmask AXI completion interrupt.
105102 */
106− val = (CC_REG_OFFSET(HOST_RGF, HOST_IMR) & ~irq);
107− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), val);
103+ val = (CC_REG(HOST_IMR) & ~irq);
104+ cc_iowrite(drvdata, CC_REG(HOST_IMR), val);
108105 }
109106
110107 /* The function called once at driver entry point .*/
111108 int ssi_fips_init(struct ssi_drvdata *p_drvdata)
112109 {
113110 struct ssi_fips_handle *fips_h;
111+ struct device *dev = drvdata_to_dev(p_drvdata);
114112
115113 fips_h = kzalloc(sizeof(*fips_h), GFP_KERNEL);
116114 if (!fips_h)
@@ -118,11 +116,11 @@ int ssi_fips_init(struct ssi_drvdata *p_drvdata) · 1 unmodified line
118116
119117 p_drvdata->fips_handle = fips_h;
120118
121− SSI_LOG_DEBUG("Initializing fips tasklet\n");
119+ dev_dbg(dev, "Initializing fips tasklet\n");
122120 tasklet_init(&fips_h->tasklet, fips_dsr, (unsigned long)p_drvdata);
123121
124122 if (!cc_get_tee_fips_status(p_drvdata))
125− tee_fips_error();
123+ tee_fips_error(dev);
126124
127125 return 0;
128126 }
drivers/staging/ccree/ssi_fips.h+2−2
@@ -40,8 +40,8 @@ static inline int ssi_fips_init(struct ssi_drvdata *p_drvdata) · 39 unmodified lines
4040 }
4141
4242 static inline void ssi_fips_fini(struct ssi_drvdata *drvdata) {}
43−void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool ok) {}
44−void fips_handler(struct ssi_drvdata *drvdata) {}
43+static inline void cc_set_ree_fips_status(struct ssi_drvdata *drvdata, bool ok) {}
44+static inline void fips_handler(struct ssi_drvdata *drvdata) {}
4545
4646 #endif /* CONFIG_CRYPTO_FIPS */
4747
drivers/staging/ccree/ssi_hash.c+182−195
@@ -134,14 +134,13 @@ static int ssi_hash_map_result(struct device *dev, · 133 unmodified lines
134134 digestsize,
135135 DMA_BIDIRECTIONAL);
136136 if (unlikely(dma_mapping_error(dev, state->digest_result_dma_addr))) {
137− SSI_LOG_ERR("Mapping digest result buffer %u B for DMA failed\n",
138− digestsize);
137+ dev_err(dev, "Mapping digest result buffer %u B for DMA failed\n",
138+ digestsize);
139139 return -ENOMEM;
140140 }
141− SSI_LOG_DEBUG("Mapped digest result buffer %u B "
142− "at va=%pK to dma=%pad\n",
141+ dev_dbg(dev, "Mapped digest result buffer %u B at va=%pK to dma=%pad\n",
143142 digestsize, state->digest_result_buff,
144− state->digest_result_dma_addr);
143+ &state->digest_result_dma_addr);
145144
146145 return 0;
147146 }
@@ -158,54 +157,50 @@ static int ssi_hash_map_request(struct device *dev, · 10 unmodified lines
158157 int rc = -ENOMEM;
159158
160159 state->buff0 = kzalloc(SSI_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA);
161− if (!state->buff0) {
162− SSI_LOG_ERR("Allocating buff0 in context failed\n");
160+ if (!state->buff0)
163161 goto fail0;
164− }
162+
165163 state->buff1 = kzalloc(SSI_MAX_HASH_BLCK_SIZE, GFP_KERNEL | GFP_DMA);
166− if (!state->buff1) {
167− SSI_LOG_ERR("Allocating buff1 in context failed\n");
164+ if (!state->buff1)
168165 goto fail_buff0;
169− }
166+
170167 state->digest_result_buff = kzalloc(SSI_MAX_HASH_DIGEST_SIZE, GFP_KERNEL | GFP_DMA);
171− if (!state->digest_result_buff) {
172− SSI_LOG_ERR("Allocating digest_result_buff in context failed\n");
168+ if (!state->digest_result_buff)
173169 goto fail_buff1;
174− }
170+
175171 state->digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL | GFP_DMA);
176− if (!state->digest_buff) {
177− SSI_LOG_ERR("Allocating digest-buffer in context failed\n");
172+ if (!state->digest_buff)
178173 goto fail_digest_result_buff;
179− }
180174
181− SSI_LOG_DEBUG("Allocated digest-buffer in context ctx->digest_buff=@%p\n", state->digest_buff);
175+ dev_dbg(dev, "Allocated digest-buffer in context ctx->digest_buff=@%p\n",
176+ state->digest_buff);
182177 if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) {
183178 state->digest_bytes_len = kzalloc(HASH_LEN_SIZE, GFP_KERNEL | GFP_DMA);
184− if (!state->digest_bytes_len) {
185− SSI_LOG_ERR("Allocating digest-bytes-len in context failed\n");
179+ if (!state->digest_bytes_len)
186180 goto fail1;
187− }
188− SSI_LOG_DEBUG("Allocated digest-bytes-len in context state->>digest_bytes_len=@%p\n", state->digest_bytes_len);
181+
182+ dev_dbg(dev, "Allocated digest-bytes-len in context state->>digest_bytes_len=@%p\n",
183+ state->digest_bytes_len);
189184 } else {
190185 state->digest_bytes_len = NULL;
191186 }
192187
193188 state->opad_digest_buff = kzalloc(ctx->inter_digestsize, GFP_KERNEL | GFP_DMA);
194− if (!state->opad_digest_buff) {
195− SSI_LOG_ERR("Allocating opad-digest-buffer in context failed\n");
189+ if (!state->opad_digest_buff)
196190 goto fail2;
197− }
198− SSI_LOG_DEBUG("Allocated opad-digest-buffer in context state->digest_bytes_len=@%p\n", state->opad_digest_buff);
191+
192+ dev_dbg(dev, "Allocated opad-digest-buffer in context state->digest_bytes_len=@%p\n",
193+ state->opad_digest_buff);
199194
200195 state->digest_buff_dma_addr = dma_map_single(dev, (void *)state->digest_buff, ctx->inter_digestsize, DMA_BIDIRECTIONAL);
201196 if (dma_mapping_error(dev, state->digest_buff_dma_addr)) {
202− SSI_LOG_ERR("Mapping digest len %d B at va=%pK for DMA failed\n",
203− ctx->inter_digestsize, state->digest_buff);
197+ dev_err(dev, "Mapping digest len %d B at va=%pK for DMA failed\n",
198+ ctx->inter_digestsize, state->digest_buff);
204199 goto fail3;
205200 }
206− SSI_LOG_DEBUG("Mapped digest %d B at va=%pK to dma=%pad\n",
207− ctx->inter_digestsize, state->digest_buff,
208− state->digest_buff_dma_addr);
201+ dev_dbg(dev, "Mapped digest %d B at va=%pK to dma=%pad\n",
202+ ctx->inter_digestsize, state->digest_buff,
203+ &state->digest_buff_dma_addr);
209204
210205 if (is_hmac) {
211206 dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL);
@@ -240,7 +235,7 @@ static int ssi_hash_map_request(struct device *dev, · 28 unmodified lines
240235
241236 rc = send_request(ctx->drvdata, &ssi_req, &desc, 1, 0);
242237 if (unlikely(rc != 0)) {
243− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
238+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
244239 goto fail4;
245240 }
246241 }
@@ -248,13 +243,13 @@ static int ssi_hash_map_request(struct device *dev, · 1 unmodified line
248243 if (ctx->hw_mode != DRV_CIPHER_XCBC_MAC) {
249244 state->digest_bytes_len_dma_addr = dma_map_single(dev, (void *)state->digest_bytes_len, HASH_LEN_SIZE, DMA_BIDIRECTIONAL);
250245 if (dma_mapping_error(dev, state->digest_bytes_len_dma_addr)) {
251− SSI_LOG_ERR("Mapping digest len %u B at va=%pK for DMA failed\n",
252− HASH_LEN_SIZE, state->digest_bytes_len);
246+ dev_err(dev, "Mapping digest len %u B at va=%pK for DMA failed\n",
247+ HASH_LEN_SIZE, state->digest_bytes_len);
253248 goto fail4;
254249 }
255− SSI_LOG_DEBUG("Mapped digest len %u B at va=%pK to dma=%pad\n",
256− HASH_LEN_SIZE, state->digest_bytes_len,
257− state->digest_bytes_len_dma_addr);
250+ dev_dbg(dev, "Mapped digest len %u B at va=%pK to dma=%pad\n",
251+ HASH_LEN_SIZE, state->digest_bytes_len,
252+ &state->digest_bytes_len_dma_addr);
258253 } else {
259254 state->digest_bytes_len_dma_addr = 0;
260255 }
@@ -262,14 +257,14 @@ static int ssi_hash_map_request(struct device *dev, · 1 unmodified line
262257 if (is_hmac && ctx->hash_mode != DRV_HASH_NULL) {
263258 state->opad_digest_dma_addr = dma_map_single(dev, (void *)state->opad_digest_buff, ctx->inter_digestsize, DMA_BIDIRECTIONAL);
264259 if (dma_mapping_error(dev, state->opad_digest_dma_addr)) {
265− SSI_LOG_ERR("Mapping opad digest %d B at va=%pK for DMA failed\n",
266− ctx->inter_digestsize,
267− state->opad_digest_buff);
260+ dev_err(dev, "Mapping opad digest %d B at va=%pK for DMA failed\n",
261+ ctx->inter_digestsize,
262+ state->opad_digest_buff);
268263 goto fail5;
269264 }
270− SSI_LOG_DEBUG("Mapped opad digest %d B at va=%pK to dma=%pad\n",
271− ctx->inter_digestsize, state->opad_digest_buff,
272− state->opad_digest_dma_addr);
265+ dev_dbg(dev, "Mapped opad digest %d B at va=%pK to dma=%pad\n",
266+ ctx->inter_digestsize, state->opad_digest_buff,
267+ &state->opad_digest_dma_addr);
273268 } else {
274269 state->opad_digest_dma_addr = 0;
275270 }
@@ -316,22 +311,22 @@ static void ssi_hash_unmap_request(struct device *dev, · 40 unmodified lines
316311 if (state->digest_buff_dma_addr != 0) {
317312 dma_unmap_single(dev, state->digest_buff_dma_addr,
318313 ctx->inter_digestsize, DMA_BIDIRECTIONAL);
319− SSI_LOG_DEBUG("Unmapped digest-buffer: digest_buff_dma_addr=%pad\n",
320− state->digest_buff_dma_addr);
314+ dev_dbg(dev, "Unmapped digest-buffer: digest_buff_dma_addr=%pad\n",
315+ &state->digest_buff_dma_addr);
321316 state->digest_buff_dma_addr = 0;
322317 }
323318 if (state->digest_bytes_len_dma_addr != 0) {
324319 dma_unmap_single(dev, state->digest_bytes_len_dma_addr,
325320 HASH_LEN_SIZE, DMA_BIDIRECTIONAL);
326− SSI_LOG_DEBUG("Unmapped digest-bytes-len buffer: digest_bytes_len_dma_addr=%pad\n",
327− state->digest_bytes_len_dma_addr);
321+ dev_dbg(dev, "Unmapped digest-bytes-len buffer: digest_bytes_len_dma_addr=%pad\n",
322+ &state->digest_bytes_len_dma_addr);
328323 state->digest_bytes_len_dma_addr = 0;
329324 }
330325 if (state->opad_digest_dma_addr != 0) {
331326 dma_unmap_single(dev, state->opad_digest_dma_addr,
332327 ctx->inter_digestsize, DMA_BIDIRECTIONAL);
333− SSI_LOG_DEBUG("Unmapped opad-digest: opad_digest_dma_addr=%pad\n",
334− state->opad_digest_dma_addr);
328+ dev_dbg(dev, "Unmapped opad-digest: opad_digest_dma_addr=%pad\n",
329+ &state->opad_digest_dma_addr);
335330 state->opad_digest_dma_addr = 0;
336331 }
337332
@@ -352,11 +347,9 @@ static void ssi_hash_unmap_result(struct device *dev, · 14 unmodified lines
352347 state->digest_result_dma_addr,
353348 digestsize,
354349 DMA_BIDIRECTIONAL);
355− SSI_LOG_DEBUG("unmpa digest result buffer "
356− "va (%pK) pa (%pad) len %u\n",
357− state->digest_result_buff,
358− state->digest_result_dma_addr,
359− digestsize);
350+ dev_dbg(dev, "unmpa digest result buffer va (%pK) pa (%pad) len %u\n",
351+ state->digest_result_buff,
352+ &state->digest_result_dma_addr, digestsize);
360353 memcpy(result,
361354 state->digest_result_buff,
362355 digestsize);
@@ -369,7 +362,7 @@ static void ssi_hash_update_complete(struct device *dev, void *ssi_req, void __i · 6 unmodified lines
369362 struct ahash_request *req = (struct ahash_request *)ssi_req;
370363 struct ahash_req_ctx *state = ahash_request_ctx(req);
371364
372− SSI_LOG_DEBUG("req=%pK\n", req);
365+ dev_dbg(dev, "req=%pK\n", req);
373366
374367 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, false);
375368 req->base.complete(&req->base, 0);
@@ -383,7 +376,7 @@ static void ssi_hash_digest_complete(struct device *dev, void *ssi_req, void __i · 7 unmodified lines
383376 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
384377 u32 digestsize = crypto_ahash_digestsize(tfm);
385378
386− SSI_LOG_DEBUG("req=%pK\n", req);
379+ dev_dbg(dev, "req=%pK\n", req);
387380
388381 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, false);
389382 ssi_hash_unmap_result(dev, state, digestsize, req->result);
@@ -399,7 +392,7 @@ static void ssi_hash_complete(struct device *dev, void *ssi_req, void __iomem *c · 9 unmodified lines
399392 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
400393 u32 digestsize = crypto_ahash_digestsize(tfm);
401394
402− SSI_LOG_DEBUG("req=%pK\n", req);
395+ dev_dbg(dev, "req=%pK\n", req);
403396
404397 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, false);
405398 ssi_hash_unmap_result(dev, state, digestsize, req->result);
@@ -414,7 +407,7 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, · 8 unmodified lines
414407 unsigned int nbytes, u8 *result,
415408 void *async_req)
416409 {
417− struct device *dev = &ctx->drvdata->plat_dev->dev;
410+ struct device *dev = drvdata_to_dev(ctx->drvdata);
418411 bool is_hmac = ctx->is_hmac;
419412 struct ssi_crypto_req ssi_req = {};
420413 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
@@ -423,20 +416,21 @@ static int ssi_hash_digest(struct ahash_req_ctx *state, · 2 unmodified lines
423416 int idx = 0;
424417 int rc = 0;
425418
426− SSI_LOG_DEBUG("===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes);
419+ dev_dbg(dev, "===== %s-digest (%d) ====\n", is_hmac ? "hmac" : "hash",
420+ nbytes);
427421
428422 if (unlikely(ssi_hash_map_request(dev, state, ctx) != 0)) {
429− SSI_LOG_ERR("map_ahash_source() failed\n");
423+ dev_err(dev, "map_ahash_source() failed\n");
430424 return -ENOMEM;
431425 }
432426
433427 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
434− SSI_LOG_ERR("map_ahash_digest() failed\n");
428+ dev_err(dev, "map_ahash_digest() failed\n");
435429 return -ENOMEM;
436430 }
437431
438432 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1) != 0)) {
439− SSI_LOG_ERR("map_ahash_request_final() failed\n");
433+ dev_err(dev, "map_ahash_request_final() failed\n");
440434 return -ENOMEM;
441435 }
442436
@@ -553,7 +547,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); · 110 unmodified lines
553547 if (async_req) {
554548 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
555549 if (unlikely(rc != -EINPROGRESS)) {
556− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
550+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
557551 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
558552 ssi_hash_unmap_result(dev, state, digestsize, result);
559553 ssi_hash_unmap_request(dev, state, ctx);
@@ -561,7 +555,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); · 1 unmodified line
561555 } else {
562556 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
563557 if (rc != 0) {
564− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
558+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
565559 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
566560 } else {
567561 ssi_buffer_mgr_unmap_hash_request(dev, state, src, false);
@@ -579,14 +573,14 @@ static int ssi_hash_update(struct ahash_req_ctx *state, · 11 unmodified lines
579573 unsigned int nbytes,
580574 void *async_req)
581575 {
582− struct device *dev = &ctx->drvdata->plat_dev->dev;
576+ struct device *dev = drvdata_to_dev(ctx->drvdata);
583577 struct ssi_crypto_req ssi_req = {};
584578 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
585579 u32 idx = 0;
586580 int rc;
587581
588− SSI_LOG_DEBUG("===== %s-update (%d) ====\n", ctx->is_hmac ?
589− "hmac" : "hash", nbytes);
582+ dev_dbg(dev, "===== %s-update (%d) ====\n", ctx->is_hmac ?
583+ "hmac" : "hash", nbytes);
590584
591585 if (nbytes == 0) {
592586 /* no real updates required */
@@ -596,12 +590,12 @@ static int ssi_hash_update(struct ahash_req_ctx *state, · 3 unmodified lines
596590 rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, src, nbytes, block_size);
597591 if (unlikely(rc)) {
598592 if (rc == 1) {
599− SSI_LOG_DEBUG(" data size not require HW update %x\n",
600− nbytes);
593+ dev_dbg(dev, " data size not require HW update %x\n",
594+ nbytes);
601595 /* No hardware updates are required */
602596 return 0;
603597 }
604− SSI_LOG_ERR("map_ahash_request_update() failed\n");
598+ dev_err(dev, "map_ahash_request_update() failed\n");
605599 return -ENOMEM;
606600 }
607601
@@ -653,13 +647,13 @@ static int ssi_hash_update(struct ahash_req_ctx *state, · 45 unmodified lines
653647 if (async_req) {
654648 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
655649 if (unlikely(rc != -EINPROGRESS)) {
656− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
650+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
657651 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
658652 }
659653 } else {
660654 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
661655 if (rc != 0) {
662− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
656+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
663657 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
664658 } else {
665659 ssi_buffer_mgr_unmap_hash_request(dev, state, src, false);
@@ -676,21 +670,22 @@ static int ssi_hash_finup(struct ahash_req_ctx *state, · 10 unmodified lines
676670 u8 *result,
677671 void *async_req)
678672 {
679− struct device *dev = &ctx->drvdata->plat_dev->dev;
673+ struct device *dev = drvdata_to_dev(ctx->drvdata);
680674 bool is_hmac = ctx->is_hmac;
681675 struct ssi_crypto_req ssi_req = {};
682676 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
683677 int idx = 0;
684678 int rc;
685679
686− SSI_LOG_DEBUG("===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes);
680+ dev_dbg(dev, "===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash",
681+ nbytes);
687682
688683 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1) != 0)) {
689− SSI_LOG_ERR("map_ahash_request_final() failed\n");
684+ dev_err(dev, "map_ahash_request_final() failed\n");
690685 return -ENOMEM;
691686 }
692687 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
693− SSI_LOG_ERR("map_ahash_digest() failed\n");
688+ dev_err(dev, "map_ahash_digest() failed\n");
694689 return -ENOMEM;
695690 }
696691
@@ -783,14 +778,14 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); · 86 unmodified lines
783778 if (async_req) {
784779 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
785780 if (unlikely(rc != -EINPROGRESS)) {
786− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
781+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
787782 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
788783 ssi_hash_unmap_result(dev, state, digestsize, result);
789784 }
790785 } else {
791786 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
792787 if (rc != 0) {
793− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
788+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
794789 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
795790 ssi_hash_unmap_result(dev, state, digestsize, result);
796791 } else {
@@ -810,22 +805,23 @@ static int ssi_hash_final(struct ahash_req_ctx *state, · 13 unmodified lines
810805 u8 *result,
811806 void *async_req)
812807 {
813− struct device *dev = &ctx->drvdata->plat_dev->dev;
808+ struct device *dev = drvdata_to_dev(ctx->drvdata);
814809 bool is_hmac = ctx->is_hmac;
815810 struct ssi_crypto_req ssi_req = {};
816811 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
817812 int idx = 0;
818813 int rc;
819814
820− SSI_LOG_DEBUG("===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash", nbytes);
815+ dev_dbg(dev, "===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash",
816+ nbytes);
821817
822818 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, src, nbytes, 0) != 0)) {
823− SSI_LOG_ERR("map_ahash_request_final() failed\n");
819+ dev_err(dev, "map_ahash_request_final() failed\n");
824820 return -ENOMEM;
825821 }
826822
827823 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
828− SSI_LOG_ERR("map_ahash_digest() failed\n");
824+ dev_err(dev, "map_ahash_digest() failed\n");
829825 return -ENOMEM;
830826 }
831827
@@ -927,14 +923,14 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); · 95 unmodified lines
927923 if (async_req) {
928924 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
929925 if (unlikely(rc != -EINPROGRESS)) {
930− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
926+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
931927 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
932928 ssi_hash_unmap_result(dev, state, digestsize, result);
933929 }
934930 } else {
935931 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
936932 if (rc != 0) {
937− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
933+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
938934 ssi_buffer_mgr_unmap_hash_request(dev, state, src, true);
939935 ssi_hash_unmap_result(dev, state, digestsize, result);
940936 } else {
@@ -948,7 +944,7 @@ ctx->drvdata, ctx->hash_mode), HASH_LEN_SIZE); · 7 unmodified lines
948944
949945 static int ssi_hash_init(struct ahash_req_ctx *state, struct ssi_hash_ctx *ctx)
950946 {
951− struct device *dev = &ctx->drvdata->plat_dev->dev;
947+ struct device *dev = drvdata_to_dev(ctx->drvdata);
952948
953949 state->xcbc_count = 0;
954950
@@ -970,10 +966,12 @@ static int ssi_hash_setkey(void *hash, · 15 unmodified lines
970966 int i, idx = 0, rc = 0;
971967 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
972968 ssi_sram_addr_t larval_addr;
973−
974− SSI_LOG_DEBUG("start keylen: %d", keylen);
969+ struct device *dev;
975970
976971 ctx = crypto_ahash_ctx(((struct crypto_ahash *)hash));
972+ dev = drvdata_to_dev(ctx->drvdata);
973+ dev_dbg(dev, "start keylen: %d", keylen);
974+
977975 blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash *)hash)->base);
978976 digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash));
979977
@@ -989,18 +987,16 @@ static int ssi_hash_setkey(void *hash, · 9 unmodified lines
989987
990988 if (keylen != 0) {
991989 ctx->key_params.key_dma_addr = dma_map_single(
992− &ctx->drvdata->plat_dev->dev,
993− (void *)key,
990+ dev, (void *)key,
994991 keylen, DMA_TO_DEVICE);
995− if (unlikely(dma_mapping_error(&ctx->drvdata->plat_dev->dev,
992+ if (unlikely(dma_mapping_error(dev,
996993 ctx->key_params.key_dma_addr))) {
997− SSI_LOG_ERR("Mapping key va=0x%p len=%u for"
998− " DMA failed\n", key, keylen);
994+ dev_err(dev, "Mapping key va=0x%p len=%u for DMA failed\n",
995+ key, keylen);
999996 return -ENOMEM;
1000997 }
1001− SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=%pad "
1002− "keylen=%u\n", ctx->key_params.key_dma_addr,
1003− ctx->key_params.keylen);
998+ dev_dbg(dev, "mapping key-buffer: key_dma_addr=%pad keylen=%u\n",
999+ &ctx->key_params.key_dma_addr, ctx->key_params.keylen);
10041000
10051001 if (keylen > blocksize) {
10061002 /* Load hash initial state */
@@ -1079,7 +1075,7 @@ static int ssi_hash_setkey(void *hash, · 72 unmodified lines
10791075
10801076 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 0);
10811077 if (unlikely(rc != 0)) {
1082− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
1078+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
10831079 goto out;
10841080 }
10851081
@@ -1139,12 +1135,10 @@ out: · 53 unmodified lines
11391135 crypto_ahash_set_flags((struct crypto_ahash *)hash, CRYPTO_TFM_RES_BAD_KEY_LEN);
11401136
11411137 if (ctx->key_params.key_dma_addr) {
1142− dma_unmap_single(&ctx->drvdata->plat_dev->dev,
1143− ctx->key_params.key_dma_addr,
1138+ dma_unmap_single(dev, ctx->key_params.key_dma_addr,
11441139 ctx->key_params.keylen, DMA_TO_DEVICE);
1145− SSI_LOG_DEBUG("Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n",
1146− ctx->key_params.key_dma_addr,
1147− ctx->key_params.keylen);
1140+ dev_dbg(dev, "Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n",
1141+ &ctx->key_params.key_dma_addr, ctx->key_params.keylen);
11481142 }
11491143 return rc;
11501144 }
@@ -1154,10 +1148,11 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, · 3 unmodified lines
11541148 {
11551149 struct ssi_crypto_req ssi_req = {};
11561150 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash);
1151+ struct device *dev = drvdata_to_dev(ctx->drvdata);
11571152 int idx = 0, rc = 0;
11581153 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
11591154
1160− SSI_LOG_DEBUG("===== setkey (%d) ====\n", keylen);
1155+ dev_dbg(dev, "===== setkey (%d) ====\n", keylen);
11611156
11621157 switch (keylen) {
11631158 case AES_KEYSIZE_128:
@@ -1171,19 +1166,15 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, · 7 unmodified lines
11711166 ctx->key_params.keylen = keylen;
11721167
11731168 ctx->key_params.key_dma_addr = dma_map_single(
1174− &ctx->drvdata->plat_dev->dev,
1175− (void *)key,
1169+ dev, (void *)key,
11761170 keylen, DMA_TO_DEVICE);
1177− if (unlikely(dma_mapping_error(&ctx->drvdata->plat_dev->dev,
1178− ctx->key_params.key_dma_addr))) {
1179− SSI_LOG_ERR("Mapping key va=0x%p len=%u for"
1180− " DMA failed\n", key, keylen);
1171+ if (unlikely(dma_mapping_error(dev, ctx->key_params.key_dma_addr))) {
1172+ dev_err(dev, "Mapping key va=0x%p len=%u for DMA failed\n",
1173+ key, keylen);
11811174 return -ENOMEM;
11821175 }
1183− SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=%pad "
1184− "keylen=%u\n",
1185− ctx->key_params.key_dma_addr,
1186− ctx->key_params.keylen);
1176+ dev_dbg(dev, "mapping key-buffer: key_dma_addr=%pad keylen=%u\n",
1177+ &ctx->key_params.key_dma_addr, ctx->key_params.keylen);
11871178
11881179 ctx->is_hmac = true;
11891180 /* 1. Load the AES key */
@@ -1226,12 +1217,10 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, · 36 unmodified lines
12261217 if (rc != 0)
12271218 crypto_ahash_set_flags(ahash, CRYPTO_TFM_RES_BAD_KEY_LEN);
12281219
1229− dma_unmap_single(&ctx->drvdata->plat_dev->dev,
1230− ctx->key_params.key_dma_addr,
1220+ dma_unmap_single(dev, ctx->key_params.key_dma_addr,
12311221 ctx->key_params.keylen, DMA_TO_DEVICE);
1232− SSI_LOG_DEBUG("Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n",
1233− ctx->key_params.key_dma_addr,
1234− ctx->key_params.keylen);
1222+ dev_dbg(dev, "Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n",
1223+ &ctx->key_params.key_dma_addr, ctx->key_params.keylen);
12351224
12361225 return rc;
12371226 }
@@ -1241,8 +1230,9 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, · 3 unmodified lines
12411230 const u8 *key, unsigned int keylen)
12421231 {
12431232 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash);
1233+ struct device *dev = drvdata_to_dev(ctx->drvdata);
12441234
1245− SSI_LOG_DEBUG("===== setkey (%d) ====\n", keylen);
1235+ dev_dbg(dev, "===== setkey (%d) ====\n", keylen);
12461236
12471237 ctx->is_hmac = true;
12481238
@@ -1259,16 +1249,14 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, · 10 unmodified lines
12591249
12601250 /* STAT_PHASE_1: Copy key to ctx */
12611251
1262− dma_sync_single_for_cpu(&ctx->drvdata->plat_dev->dev,
1263− ctx->opad_tmp_keys_dma_addr,
1252+ dma_sync_single_for_cpu(dev, ctx->opad_tmp_keys_dma_addr,
12641253 keylen, DMA_TO_DEVICE);
12651254
12661255 memcpy(ctx->opad_tmp_keys_buff, key, keylen);
12671256 if (keylen == 24)
12681257 memset(ctx->opad_tmp_keys_buff + 24, 0, CC_AES_KEY_SIZE_MAX - 24);
12691258
1270− dma_sync_single_for_device(&ctx->drvdata->plat_dev->dev,
1271− ctx->opad_tmp_keys_dma_addr,
1259+ dma_sync_single_for_device(dev, ctx->opad_tmp_keys_dma_addr,
12721260 keylen, DMA_TO_DEVICE);
12731261
12741262 ctx->key_params.keylen = keylen;
@@ -1279,23 +1267,21 @@ static int ssi_cmac_setkey(struct crypto_ahash *ahash, · 4 unmodified lines
12791267
12801268 static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx)
12811269 {
1282− struct device *dev = &ctx->drvdata->plat_dev->dev;
1270+ struct device *dev = drvdata_to_dev(ctx->drvdata);
12831271
12841272 if (ctx->digest_buff_dma_addr != 0) {
12851273 dma_unmap_single(dev, ctx->digest_buff_dma_addr,
12861274 sizeof(ctx->digest_buff), DMA_BIDIRECTIONAL);
1287− SSI_LOG_DEBUG("Unmapped digest-buffer: "
1288− "digest_buff_dma_addr=%pad\n",
1289− ctx->digest_buff_dma_addr);
1275+ dev_dbg(dev, "Unmapped digest-buffer: digest_buff_dma_addr=%pad\n",
1276+ &ctx->digest_buff_dma_addr);
12901277 ctx->digest_buff_dma_addr = 0;
12911278 }
12921279 if (ctx->opad_tmp_keys_dma_addr != 0) {
12931280 dma_unmap_single(dev, ctx->opad_tmp_keys_dma_addr,
12941281 sizeof(ctx->opad_tmp_keys_buff),
12951282 DMA_BIDIRECTIONAL);
1296− SSI_LOG_DEBUG("Unmapped opad-digest: "
1297− "opad_tmp_keys_dma_addr=%pad\n",
1298− ctx->opad_tmp_keys_dma_addr);
1283+ dev_dbg(dev, "Unmapped opad-digest: opad_tmp_keys_dma_addr=%pad\n",
1284+ &ctx->opad_tmp_keys_dma_addr);
12991285 ctx->opad_tmp_keys_dma_addr = 0;
13001286 }
13011287
@@ -1304,30 +1290,30 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) · 2 unmodified lines
13041290
13051291 static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx)
13061292 {
1307− struct device *dev = &ctx->drvdata->plat_dev->dev;
1293+ struct device *dev = drvdata_to_dev(ctx->drvdata);
13081294
13091295 ctx->key_params.keylen = 0;
13101296
13111297 ctx->digest_buff_dma_addr = dma_map_single(dev, (void *)ctx->digest_buff, sizeof(ctx->digest_buff), DMA_BIDIRECTIONAL);
13121298 if (dma_mapping_error(dev, ctx->digest_buff_dma_addr)) {
1313− SSI_LOG_ERR("Mapping digest len %zu B at va=%pK for DMA failed\n",
1314− sizeof(ctx->digest_buff), ctx->digest_buff);
1299+ dev_err(dev, "Mapping digest len %zu B at va=%pK for DMA failed\n",
1300+ sizeof(ctx->digest_buff), ctx->digest_buff);
13151301 goto fail;
13161302 }
1317− SSI_LOG_DEBUG("Mapped digest %zu B at va=%pK to dma=%pad\n",
1318− sizeof(ctx->digest_buff), ctx->digest_buff,
1319− ctx->digest_buff_dma_addr);
1303+ dev_dbg(dev, "Mapped digest %zu B at va=%pK to dma=%pad\n",
1304+ sizeof(ctx->digest_buff), ctx->digest_buff,
1305+ &ctx->digest_buff_dma_addr);
13201306
13211307 ctx->opad_tmp_keys_dma_addr = dma_map_single(dev, (void *)ctx->opad_tmp_keys_buff, sizeof(ctx->opad_tmp_keys_buff), DMA_BIDIRECTIONAL);
13221308 if (dma_mapping_error(dev, ctx->opad_tmp_keys_dma_addr)) {
1323− SSI_LOG_ERR("Mapping opad digest %zu B at va=%pK for DMA failed\n",
1324− sizeof(ctx->opad_tmp_keys_buff),
1325− ctx->opad_tmp_keys_buff);
1309+ dev_err(dev, "Mapping opad digest %zu B at va=%pK for DMA failed\n",
1310+ sizeof(ctx->opad_tmp_keys_buff),
1311+ ctx->opad_tmp_keys_buff);
13261312 goto fail;
13271313 }
1328− SSI_LOG_DEBUG("Mapped opad_tmp_keys %zu B at va=%pK to dma=%pad\n",
1329− sizeof(ctx->opad_tmp_keys_buff), ctx->opad_tmp_keys_buff,
1330− ctx->opad_tmp_keys_dma_addr);
1314+ dev_dbg(dev, "Mapped opad_tmp_keys %zu B at va=%pK to dma=%pad\n",
1315+ sizeof(ctx->opad_tmp_keys_buff), ctx->opad_tmp_keys_buff,
1316+ &ctx->opad_tmp_keys_dma_addr);
13311317
13321318 ctx->is_hmac = false;
13331319 return 0;
@@ -1361,8 +1347,9 @@ static int ssi_ahash_cra_init(struct crypto_tfm *tfm) · 27 unmodified lines
13611347 static void ssi_hash_cra_exit(struct crypto_tfm *tfm)
13621348 {
13631349 struct ssi_hash_ctx *ctx = crypto_tfm_ctx(tfm);
1350+ struct device *dev = drvdata_to_dev(ctx->drvdata);
13641351
1365− SSI_LOG_DEBUG("ssi_hash_cra_exit");
1352+ dev_dbg(dev, "ssi_hash_cra_exit");
13661353 ssi_hash_free_ctx(ctx);
13671354 }
13681355
@@ -1371,7 +1358,7 @@ static int ssi_mac_update(struct ahash_request *req) · 2 unmodified lines
13711358 struct ahash_req_ctx *state = ahash_request_ctx(req);
13721359 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
13731360 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
1374− struct device *dev = &ctx->drvdata->plat_dev->dev;
1361+ struct device *dev = drvdata_to_dev(ctx->drvdata);
13751362 unsigned int block_size = crypto_tfm_alg_blocksize(&tfm->base);
13761363 struct ssi_crypto_req ssi_req = {};
13771364 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
@@ -1388,12 +1375,12 @@ static int ssi_mac_update(struct ahash_request *req) · 10 unmodified lines
13881375 rc = ssi_buffer_mgr_map_hash_request_update(ctx->drvdata, state, req->src, req->nbytes, block_size);
13891376 if (unlikely(rc)) {
13901377 if (rc == 1) {
1391− SSI_LOG_DEBUG(" data size not require HW update %x\n",
1392− req->nbytes);
1378+ dev_dbg(dev, " data size not require HW update %x\n",
1379+ req->nbytes);
13931380 /* No hardware updates are required */
13941381 return 0;
13951382 }
1396− SSI_LOG_ERR("map_ahash_request_update() failed\n");
1383+ dev_err(dev, "map_ahash_request_update() failed\n");
13971384 return -ENOMEM;
13981385 }
13991386
@@ -1420,7 +1407,7 @@ static int ssi_mac_update(struct ahash_request *req) · 20 unmodified lines
14201407
14211408 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
14221409 if (unlikely(rc != -EINPROGRESS)) {
1423− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
1410+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
14241411 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, true);
14251412 }
14261413 return rc;
@@ -1431,7 +1418,7 @@ static int ssi_mac_final(struct ahash_request *req) · 4 unmodified lines
14311418 struct ahash_req_ctx *state = ahash_request_ctx(req);
14321419 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
14331420 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
1434− struct device *dev = &ctx->drvdata->plat_dev->dev;
1421+ struct device *dev = drvdata_to_dev(ctx->drvdata);
14351422 struct ssi_crypto_req ssi_req = {};
14361423 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
14371424 int idx = 0;
@@ -1451,15 +1438,15 @@ static int ssi_mac_final(struct ahash_request *req) · 13 unmodified lines
14511438 key_len = ctx->key_params.keylen;
14521439 }
14531440
1454− SSI_LOG_DEBUG("===== final xcbc reminder (%d) ====\n", rem_cnt);
1441+ dev_dbg(dev, "===== final xcbc reminder (%d) ====\n", rem_cnt);
14551442
14561443 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 0) != 0)) {
1457− SSI_LOG_ERR("map_ahash_request_final() failed\n");
1444+ dev_err(dev, "map_ahash_request_final() failed\n");
14581445 return -ENOMEM;
14591446 }
14601447
14611448 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
1462− SSI_LOG_ERR("map_ahash_digest() failed\n");
1449+ dev_err(dev, "map_ahash_digest() failed\n");
14631450 return -ENOMEM;
14641451 }
14651452
@@ -1530,7 +1517,7 @@ static int ssi_mac_final(struct ahash_request *req) · 64 unmodified lines
15301517
15311518 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
15321519 if (unlikely(rc != -EINPROGRESS)) {
1533− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
1520+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
15341521 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, true);
15351522 ssi_hash_unmap_result(dev, state, digestsize, req->result);
15361523 }
@@ -1542,7 +1529,7 @@ static int ssi_mac_finup(struct ahash_request *req) · 5 unmodified lines
15421529 struct ahash_req_ctx *state = ahash_request_ctx(req);
15431530 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
15441531 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
1545− struct device *dev = &ctx->drvdata->plat_dev->dev;
1532+ struct device *dev = drvdata_to_dev(ctx->drvdata);
15461533 struct ssi_crypto_req ssi_req = {};
15471534 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
15481535 int idx = 0;
@@ -1550,18 +1537,18 @@ static int ssi_mac_finup(struct ahash_request *req) · 1 unmodified line
15501537 u32 key_len = 0;
15511538 u32 digestsize = crypto_ahash_digestsize(tfm);
15521539
1553− SSI_LOG_DEBUG("===== finup xcbc(%d) ====\n", req->nbytes);
1540+ dev_dbg(dev, "===== finup xcbc(%d) ====\n", req->nbytes);
15541541 if (state->xcbc_count > 0 && req->nbytes == 0) {
1555− SSI_LOG_DEBUG("No data to update. Call to fdx_mac_final\n");
1542+ dev_dbg(dev, "No data to update. Call to fdx_mac_final\n");
15561543 return ssi_mac_final(req);
15571544 }
15581545
15591546 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 1) != 0)) {
1560− SSI_LOG_ERR("map_ahash_request_final() failed\n");
1547+ dev_err(dev, "map_ahash_request_final() failed\n");
15611548 return -ENOMEM;
15621549 }
15631550 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
1564− SSI_LOG_ERR("map_ahash_digest() failed\n");
1551+ dev_err(dev, "map_ahash_digest() failed\n");
15651552 return -ENOMEM;
15661553 }
15671554
@@ -1601,7 +1588,7 @@ static int ssi_mac_finup(struct ahash_request *req) · 33 unmodified lines
16011588
16021589 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
16031590 if (unlikely(rc != -EINPROGRESS)) {
1604− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
1591+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
16051592 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, true);
16061593 ssi_hash_unmap_result(dev, state, digestsize, req->result);
16071594 }
@@ -1613,7 +1600,7 @@ static int ssi_mac_digest(struct ahash_request *req) · 5 unmodified lines
16131600 struct ahash_req_ctx *state = ahash_request_ctx(req);
16141601 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
16151602 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
1616− struct device *dev = &ctx->drvdata->plat_dev->dev;
1603+ struct device *dev = drvdata_to_dev(ctx->drvdata);
16171604 u32 digestsize = crypto_ahash_digestsize(tfm);
16181605 struct ssi_crypto_req ssi_req = {};
16191606 struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
@@ -1621,19 +1608,19 @@ static int ssi_mac_digest(struct ahash_request *req) · 1 unmodified line
16211608 int idx = 0;
16221609 int rc;
16231610
1624− SSI_LOG_DEBUG("===== -digest mac (%d) ====\n", req->nbytes);
1611+ dev_dbg(dev, "===== -digest mac (%d) ====\n", req->nbytes);
16251612
16261613 if (unlikely(ssi_hash_map_request(dev, state, ctx) != 0)) {
1627− SSI_LOG_ERR("map_ahash_source() failed\n");
1614+ dev_err(dev, "map_ahash_source() failed\n");
16281615 return -ENOMEM;
16291616 }
16301617 if (unlikely(ssi_hash_map_result(dev, state, digestsize) != 0)) {
1631− SSI_LOG_ERR("map_ahash_digest() failed\n");
1618+ dev_err(dev, "map_ahash_digest() failed\n");
16321619 return -ENOMEM;
16331620 }
16341621
16351622 if (unlikely(ssi_buffer_mgr_map_hash_request_final(ctx->drvdata, state, req->src, req->nbytes, 1) != 0)) {
1636− SSI_LOG_ERR("map_ahash_request_final() failed\n");
1623+ dev_err(dev, "map_ahash_request_final() failed\n");
16371624 return -ENOMEM;
16381625 }
16391626
@@ -1673,7 +1660,7 @@ static int ssi_mac_digest(struct ahash_request *req) · 33 unmodified lines
16731660
16741661 rc = send_request(ctx->drvdata, &ssi_req, desc, idx, 1);
16751662 if (unlikely(rc != -EINPROGRESS)) {
1676− SSI_LOG_ERR("send_request() failed (rc=%d)\n", rc);
1663+ dev_err(dev, "send_request() failed (rc=%d)\n", rc);
16771664 ssi_buffer_mgr_unmap_hash_request(dev, state, req->src, true);
16781665 ssi_hash_unmap_result(dev, state, digestsize, req->result);
16791666 ssi_hash_unmap_request(dev, state, ctx);
@@ -1727,8 +1714,9 @@ static int ssi_ahash_init(struct ahash_request *req) · 47 unmodified lines
17271714 struct ahash_req_ctx *state = ahash_request_ctx(req);
17281715 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
17291716 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(tfm);
1717+ struct device *dev = drvdata_to_dev(ctx->drvdata);
17301718
1731− SSI_LOG_DEBUG("===== init (%d) ====\n", req->nbytes);
1719+ dev_dbg(dev, "===== init (%d) ====\n", req->nbytes);
17321720
17331721 return ssi_hash_init(state, ctx);
17341722 }
@@ -1737,7 +1725,7 @@ static int ssi_ahash_export(struct ahash_request *req, void *out) · 2 unmodified lines
17371725 {
17381726 struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
17391727 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash);
1740− struct device *dev = &ctx->drvdata->plat_dev->dev;
1728+ struct device *dev = drvdata_to_dev(ctx->drvdata);
17411729 struct ahash_req_ctx *state = ahash_request_ctx(req);
17421730 u8 *curr_buff = state->buff_index ? state->buff1 : state->buff0;
17431731 u32 curr_buff_cnt = state->buff_index ? state->buff1_cnt :
@@ -1778,7 +1766,7 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in) · 34 unmodified lines
17781766 {
17791767 struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
17801768 struct ssi_hash_ctx *ctx = crypto_ahash_ctx(ahash);
1781− struct device *dev = &ctx->drvdata->plat_dev->dev;
1769+ struct device *dev = drvdata_to_dev(ctx->drvdata);
17821770 struct ahash_req_ctx *state = ahash_request_ctx(req);
17831771 u32 tmp;
17841772 int rc;
@@ -2054,17 +2042,17 @@ static struct ssi_hash_template driver_hash[] = { · 269 unmodified lines
20542042 };
20552043
20562044 static struct ssi_hash_alg *
2057−ssi_hash_create_alg(struct ssi_hash_template *template, bool keyed)
2045+ssi_hash_create_alg(struct ssi_hash_template *template, struct device *dev,
2046+ bool keyed)
20582047 {
20592048 struct ssi_hash_alg *t_crypto_alg;
20602049 struct crypto_alg *alg;
20612050 struct ahash_alg *halg;
20622051
20632052 t_crypto_alg = kzalloc(sizeof(*t_crypto_alg), GFP_KERNEL);
2064− if (!t_crypto_alg) {
2065− SSI_LOG_ERR("failed to allocate t_crypto_alg\n");
2053+ if (!t_crypto_alg)
20662054 return ERR_PTR(-ENOMEM);
2067− }
2055+
20682056
20692057 t_crypto_alg->ahash_alg = template->template_ahash;
20702058 halg = &t_crypto_alg->ahash_alg;
@@ -2107,6 +2095,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) · 36 unmodified lines
21072095 ssi_sram_addr_t sram_buff_ofs = hash_handle->digest_len_sram_addr;
21082096 unsigned int larval_seq_len = 0;
21092097 struct cc_hw_desc larval_seq[CC_DIGEST_SIZE_MAX / sizeof(u32)];
2098+ struct device *dev = drvdata_to_dev(drvdata);
21102099 int rc = 0;
21112100 #if (DX_DEV_SHA_MAX > 256)
21122101 int i;
@@ -2191,7 +2180,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) · 78 unmodified lines
21912180 }
21922181 rc = send_request_init(drvdata, larval_seq, larval_seq_len);
21932182 if (unlikely(rc != 0)) {
2194− SSI_LOG_ERR("send_request() failed (rc = %d)\n", rc);
2183+ dev_err(dev, "send_request() failed (rc = %d)\n", rc);
21952184 goto init_digest_const_err;
21962185 }
21972186 larval_seq_len = 0;
@@ -2209,7 +2198,7 @@ int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata) · 11 unmodified lines
22092198 }
22102199 rc = send_request_init(drvdata, larval_seq, larval_seq_len);
22112200 if (unlikely(rc != 0)) {
2212− SSI_LOG_ERR("send_request() failed (rc = %d)\n", rc);
2201+ dev_err(dev, "send_request() failed (rc = %d)\n", rc);
22132202 goto init_digest_const_err;
22142203 }
22152204 #endif
@@ -2223,17 +2212,15 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) · 7 unmodified lines
22232212 struct ssi_hash_handle *hash_handle;
22242213 ssi_sram_addr_t sram_buff;
22252214 u32 sram_size_to_alloc;
2215+ struct device *dev = drvdata_to_dev(drvdata);
22262216 int rc = 0;
22272217 int alg;
22282218
22292219 hash_handle = kzalloc(sizeof(*hash_handle), GFP_KERNEL);
2230− if (!hash_handle) {
2231− SSI_LOG_ERR("kzalloc failed to allocate %zu B\n",
2232− sizeof(*hash_handle));
2233− rc = -ENOMEM;
2234− goto fail;
2235− }
2220+ if (!hash_handle)
2221+ return -ENOMEM;
22362222
2223+ INIT_LIST_HEAD(&hash_handle->hash_list);
22372224 drvdata->hash_handle = hash_handle;
22382225
22392226 sram_size_to_alloc = sizeof(digest_len_init) +
@@ -2249,7 +2236,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) · 9 unmodified lines
22492236
22502237 sram_buff = ssi_sram_mgr_alloc(drvdata, sram_size_to_alloc);
22512238 if (sram_buff == NULL_SRAM_ADDR) {
2252− SSI_LOG_ERR("SRAM pool exhausted\n");
2239+ dev_err(dev, "SRAM pool exhausted\n");
22532240 rc = -ENOMEM;
22542241 goto fail;
22552242 }
@@ -2260,31 +2247,29 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) · 4 unmodified lines
22602247 /*must be set before the alg registration as it is being used there*/
22612248 rc = ssi_hash_init_sram_digest_consts(drvdata);
22622249 if (unlikely(rc != 0)) {
2263− SSI_LOG_ERR("Init digest CONST failed (rc=%d)\n", rc);
2250+ dev_err(dev, "Init digest CONST failed (rc=%d)\n", rc);
22642251 goto fail;
22652252 }
22662253
2267− INIT_LIST_HEAD(&hash_handle->hash_list);
2268−
22692254 /* ahash registration */
22702255 for (alg = 0; alg < ARRAY_SIZE(driver_hash); alg++) {
22712256 struct ssi_hash_alg *t_alg;
22722257 int hw_mode = driver_hash[alg].hw_mode;
22732258
22742259 /* register hmac version */
2275− t_alg = ssi_hash_create_alg(&driver_hash[alg], true);
2260+ t_alg = ssi_hash_create_alg(&driver_hash[alg], dev, true);
22762261 if (IS_ERR(t_alg)) {
22772262 rc = PTR_ERR(t_alg);
2278− SSI_LOG_ERR("%s alg allocation failed\n",
2279− driver_hash[alg].driver_name);
2263+ dev_err(dev, "%s alg allocation failed\n",
2264+ driver_hash[alg].driver_name);
22802265 goto fail;
22812266 }
22822267 t_alg->drvdata = drvdata;
22832268
22842269 rc = crypto_register_ahash(&t_alg->ahash_alg);
22852270 if (unlikely(rc)) {
2286− SSI_LOG_ERR("%s alg registration failed\n",
2287− driver_hash[alg].driver_name);
2271+ dev_err(dev, "%s alg registration failed\n",
2272+ driver_hash[alg].driver_name);
22882273 kfree(t_alg);
22892274 goto fail;
22902275 } else {
@@ -2297,19 +2282,19 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) · 6 unmodified lines
22972282 continue;
22982283
22992284 /* register hash version */
2300− t_alg = ssi_hash_create_alg(&driver_hash[alg], false);
2285+ t_alg = ssi_hash_create_alg(&driver_hash[alg], dev, false);
23012286 if (IS_ERR(t_alg)) {
23022287 rc = PTR_ERR(t_alg);
2303− SSI_LOG_ERR("%s alg allocation failed\n",
2304− driver_hash[alg].driver_name);
2288+ dev_err(dev, "%s alg allocation failed\n",
2289+ driver_hash[alg].driver_name);
23052290 goto fail;
23062291 }
23072292 t_alg->drvdata = drvdata;
23082293
23092294 rc = crypto_register_ahash(&t_alg->ahash_alg);
23102295 if (unlikely(rc)) {
2311− SSI_LOG_ERR("%s alg registration failed\n",
2312− driver_hash[alg].driver_name);
2296+ dev_err(dev, "%s alg registration failed\n",
2297+ driver_hash[alg].driver_name);
23132298 kfree(t_alg);
23142299 goto fail;
23152300 } else {
@@ -2443,6 +2428,7 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, · 127 unmodified lines
24432428 unsigned int *seq_size)
24442429 {
24452430 unsigned int idx = *seq_size;
2431+ struct device *dev = drvdata_to_dev(ctx->drvdata);
24462432
24472433 if (likely(areq_ctx->data_dma_buf_type == SSI_DMA_BUF_DLLI)) {
24482434 hw_desc_init(&desc[idx]);
@@ -2453,7 +2439,7 @@ static void ssi_hash_create_data_desc(struct ahash_req_ctx *areq_ctx, · 4 unmodified lines
24532439 idx++;
24542440 } else {
24552441 if (areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) {
2456− SSI_LOG_DEBUG(" NULL mode\n");
2442+ dev_dbg(dev, " NULL mode\n");
24572443 /* nothing to build */
24582444 return;
24592445 }
@@ -2493,6 +2479,7 @@ ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode) · 33 unmodified lines
24932479 {
24942480 struct ssi_drvdata *_drvdata = (struct ssi_drvdata *)drvdata;
24952481 struct ssi_hash_handle *hash_handle = _drvdata->hash_handle;
2482+ struct device *dev = drvdata_to_dev(_drvdata);
24962483
24972484 switch (mode) {
24982485 case DRV_HASH_NULL:
@@ -2527,7 +2514,7 @@ ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode) · 28 unmodified lines
25272514 sizeof(sha384_init));
25282515 #endif
25292516 default:
2530− SSI_LOG_ERR("Invalid hash mode (%d)\n", mode);
2517+ dev_err(dev, "Invalid hash mode (%d)\n", mode);
25312518 }
25322519
25332520 /*This is valid wrong value to avoid kernel crash*/
drivers/staging/ccree/ssi_ivgen.c+8−10
@@ -193,12 +193,9 @@ int ssi_ivgen_init(struct ssi_drvdata *drvdata) · 192 unmodified lines
193193 /* Allocate "this" context */
194194 drvdata->ivgen_handle = kzalloc(sizeof(*drvdata->ivgen_handle),
195195 GFP_KERNEL);
196− if (!drvdata->ivgen_handle) {
197− SSI_LOG_ERR("Not enough memory to allocate IVGEN context "
198− "(%zu B)\n", sizeof(*drvdata->ivgen_handle));
199− rc = -ENOMEM;
200− goto out;
201− }
196+ if (!drvdata->ivgen_handle)
197+ return -ENOMEM;
198+
202199 ivgen_ctx = drvdata->ivgen_handle;
203200
204201 /* Allocate pool's header for intial enc. key/IV */
@@ -206,15 +203,15 @@ int ssi_ivgen_init(struct ssi_drvdata *drvdata) · 1 unmodified line
206203 &ivgen_ctx->pool_meta_dma,
207204 GFP_KERNEL);
208205 if (!ivgen_ctx->pool_meta) {
209− SSI_LOG_ERR("Not enough memory to allocate DMA of pool_meta "
210− "(%u B)\n", SSI_IVPOOL_META_SIZE);
206+ dev_err(device, "Not enough memory to allocate DMA of pool_meta (%u B)\n",
207+ SSI_IVPOOL_META_SIZE);
211208 rc = -ENOMEM;
212209 goto out;
213210 }
214211 /* Allocate IV pool in SRAM */
215212 ivgen_ctx->pool = ssi_sram_mgr_alloc(drvdata, SSI_IVPOOL_SIZE);
216213 if (ivgen_ctx->pool == NULL_SRAM_ADDR) {
217− SSI_LOG_ERR("SRAM pool exhausted\n");
214+ dev_err(device, "SRAM pool exhausted\n");
218215 rc = -ENOMEM;
219216 goto out;
220217 }
@@ -248,6 +245,7 @@ int ssi_ivgen_getiv( · 27 unmodified lines
248245 {
249246 struct ssi_ivgen_ctx *ivgen_ctx = drvdata->ivgen_handle;
250247 unsigned int idx = *iv_seq_len;
248+ struct device *dev = drvdata_to_dev(drvdata);
251249 unsigned int t;
252250
253251 if ((iv_out_size != CC_AES_IV_SIZE) &&
@@ -291,7 +289,7 @@ int ssi_ivgen_getiv( · 37 unmodified lines
291289 ivgen_ctx->next_iv_ofs += iv_out_size;
292290
293291 if ((SSI_IVPOOL_SIZE - ivgen_ctx->next_iv_ofs) < CC_AES_IV_SIZE) {
294− SSI_LOG_DEBUG("Pool exhausted, regenerating iv-pool\n");
292+ dev_dbg(dev, "Pool exhausted, regenerating iv-pool\n");
295293 /* pool is drained -regenerate it! */
296294 return ssi_ivgen_generate_pool(ivgen_ctx, iv_seq, iv_seq_len);
297295 }
drivers/staging/ccree/ssi_pm.c+18−17
@@ -40,11 +40,12 @@ int ssi_power_mgr_runtime_suspend(struct device *dev) · 39 unmodified lines
4040 (struct ssi_drvdata *)dev_get_drvdata(dev);
4141 int rc;
4242
43− SSI_LOG_DEBUG("set HOST_POWER_DOWN_EN\n");
44− WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE);
43+ dev_dbg(dev, "set HOST_POWER_DOWN_EN\n");
44+ cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_ENABLE);
4545 rc = ssi_request_mgr_runtime_suspend_queue(drvdata);
4646 if (rc != 0) {
47− SSI_LOG_ERR("ssi_request_mgr_runtime_suspend_queue (%x)\n", rc);
47+ dev_err(dev, "ssi_request_mgr_runtime_suspend_queue (%x)\n",
48+ rc);
4849 return rc;
4950 }
5051 fini_cc_regs(drvdata);
@@ -58,24 +59,24 @@ int ssi_power_mgr_runtime_resume(struct device *dev) · 7 unmodified lines
5859 struct ssi_drvdata *drvdata =
5960 (struct ssi_drvdata *)dev_get_drvdata(dev);
6061
61− SSI_LOG_DEBUG("unset HOST_POWER_DOWN_EN\n");
62− WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE);
62+ dev_dbg(dev, "unset HOST_POWER_DOWN_EN\n");
63+ cc_iowrite(drvdata, CC_REG(HOST_POWER_DOWN_EN), POWER_DOWN_DISABLE);
6364
6465 rc = cc_clk_on(drvdata);
6566 if (rc) {
66− SSI_LOG_ERR("failed getting clock back on. We're toast.\n");
67+ dev_err(dev, "failed getting clock back on. We're toast.\n");
6768 return rc;
6869 }
6970
7071 rc = init_cc_regs(drvdata, false);
7172 if (rc != 0) {
72− SSI_LOG_ERR("init_cc_regs (%x)\n", rc);
73+ dev_err(dev, "init_cc_regs (%x)\n", rc);
7374 return rc;
7475 }
7576
7677 rc = ssi_request_mgr_runtime_resume_queue(drvdata);
7778 if (rc != 0) {
78− SSI_LOG_ERR("ssi_request_mgr_runtime_resume_queue (%x)\n", rc);
79+ dev_err(dev, "ssi_request_mgr_runtime_resume_queue (%x)\n", rc);
7980 return rc;
8081 }
8182
@@ -109,7 +110,8 @@ int ssi_power_mgr_runtime_put_suspend(struct device *dev) · 27 unmodified lines
109110 rc = pm_runtime_put_autosuspend(dev);
110111 } else {
111112 /* Something wrong happens*/
112− BUG();
113+ dev_err(dev, "request to suspend already suspended queue");
114+ rc = -EBUSY;
113115 }
114116 return rc;
115117 }
@@ -120,16 +122,17 @@ int ssi_power_mgr_init(struct ssi_drvdata *drvdata) · 4 unmodified lines
120122 {
121123 int rc = 0;
122124 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
123− struct platform_device *plat_dev = drvdata->plat_dev;
125+ struct device *dev = drvdata_to_dev(drvdata);
126+
124127 /* must be before the enabling to avoid resdundent suspending */
125− pm_runtime_set_autosuspend_delay(&plat_dev->dev, SSI_SUSPEND_TIMEOUT);
126− pm_runtime_use_autosuspend(&plat_dev->dev);
128+ pm_runtime_set_autosuspend_delay(dev, SSI_SUSPEND_TIMEOUT);
129+ pm_runtime_use_autosuspend(dev);
127130 /* activate the PM module */
128− rc = pm_runtime_set_active(&plat_dev->dev);
131+ rc = pm_runtime_set_active(dev);
129132 if (rc != 0)
130133 return rc;
131134 /* enable the PM module*/
132− pm_runtime_enable(&plat_dev->dev);
135+ pm_runtime_enable(dev);
133136 #endif
134137 return rc;
135138 }
@@ -137,8 +140,6 @@ int ssi_power_mgr_init(struct ssi_drvdata *drvdata) · 1 unmodified line
137140 void ssi_power_mgr_fini(struct ssi_drvdata *drvdata)
138141 {
139142 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
140− struct platform_device *plat_dev = drvdata->plat_dev;
141−
142− pm_runtime_disable(&plat_dev->dev);
143+ pm_runtime_disable(drvdata_to_dev(drvdata));
143144 #endif
144145 }
drivers/staging/ccree/ssi_request_mgr.c+104−91
@@ -49,7 +49,6 @@ struct ssi_request_mgr_handle { · 48 unmodified lines
4949 dma_addr_t dummy_comp_buff_dma;
5050 struct cc_hw_desc monitor_desc;
5151
52− volatile unsigned long monitor_lock;
5352 #ifdef COMP_IN_WQ
5453 struct workqueue_struct *workq;
5554 struct delayed_work compwork;
@@ -69,19 +68,19 @@ static void comp_work_handler(struct work_struct *work); · 13 unmodified lines
6968 void request_mgr_fini(struct ssi_drvdata *drvdata)
7069 {
7170 struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle;
71+ struct device *dev = drvdata_to_dev(drvdata);
7272
7373 if (!req_mgr_h)
7474 return; /* Not allocated */
7575
7676 if (req_mgr_h->dummy_comp_buff_dma != 0) {
77− dma_free_coherent(&drvdata->plat_dev->dev,
78− sizeof(u32), req_mgr_h->dummy_comp_buff,
77+ dma_free_coherent(dev, sizeof(u32), req_mgr_h->dummy_comp_buff,
7978 req_mgr_h->dummy_comp_buff_dma);
8079 }
8180
82− SSI_LOG_DEBUG("max_used_hw_slots=%d\n", (req_mgr_h->hw_queue_size -
81+ dev_dbg(dev, "max_used_hw_slots=%d\n", (req_mgr_h->hw_queue_size -
8382 req_mgr_h->min_free_hw_slots));
84− SSI_LOG_DEBUG("max_used_sw_slots=%d\n", req_mgr_h->max_used_sw_slots);
83+ dev_dbg(dev, "max_used_sw_slots=%d\n", req_mgr_h->max_used_sw_slots);
8584
8685 #ifdef COMP_IN_WQ
8786 flush_workqueue(req_mgr_h->workq);
@@ -98,6 +97,7 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) · 10 unmodified lines
9897 int request_mgr_init(struct ssi_drvdata *drvdata)
9998 {
10099 struct ssi_request_mgr_handle *req_mgr_h;
100+ struct device *dev = drvdata_to_dev(drvdata);
101101 int rc = 0;
102102
103103 req_mgr_h = kzalloc(sizeof(*req_mgr_h), GFP_KERNEL);
@@ -110,24 +110,24 @@ int request_mgr_init(struct ssi_drvdata *drvdata) · 6 unmodified lines
110110
111111 spin_lock_init(&req_mgr_h->hw_lock);
112112 #ifdef COMP_IN_WQ
113− SSI_LOG_DEBUG("Initializing completion workqueue\n");
113+ dev_dbg(dev, "Initializing completion workqueue\n");
114114 req_mgr_h->workq = create_singlethread_workqueue("arm_cc7x_wq");
115115 if (unlikely(!req_mgr_h->workq)) {
116− SSI_LOG_ERR("Failed creating work queue\n");
116+ dev_err(dev, "Failed creating work queue\n");
117117 rc = -ENOMEM;
118118 goto req_mgr_init_err;
119119 }
120120 INIT_DELAYED_WORK(&req_mgr_h->compwork, comp_work_handler);
121121 #else
122− SSI_LOG_DEBUG("Initializing completion tasklet\n");
122+ dev_dbg(dev, "Initializing completion tasklet\n");
123123 tasklet_init(&req_mgr_h->comptask, comp_handler, (unsigned long)drvdata);
124124 #endif
125− req_mgr_h->hw_queue_size = READ_REGISTER(drvdata->cc_base +
126− CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_SRAM_SIZE));
127− SSI_LOG_DEBUG("hw_queue_size=0x%08X\n", req_mgr_h->hw_queue_size);
125+ req_mgr_h->hw_queue_size = cc_ioread(drvdata,
126+ CC_REG(DSCRPTR_QUEUE_SRAM_SIZE));
127+ dev_dbg(dev, "hw_queue_size=0x%08X\n", req_mgr_h->hw_queue_size);
128128 if (req_mgr_h->hw_queue_size < MIN_HW_QUEUE_SIZE) {
129− SSI_LOG_ERR("Invalid HW queue size = %u (Min. required is %u)\n",
130− req_mgr_h->hw_queue_size, MIN_HW_QUEUE_SIZE);
129+ dev_err(dev, "Invalid HW queue size = %u (Min. required is %u)\n",
130+ req_mgr_h->hw_queue_size, MIN_HW_QUEUE_SIZE);
131131 rc = -ENOMEM;
132132 goto req_mgr_init_err;
133133 }
@@ -135,13 +135,12 @@ int request_mgr_init(struct ssi_drvdata *drvdata) · 1 unmodified line
135135 req_mgr_h->max_used_sw_slots = 0;
136136
137137 /* Allocate DMA word for "dummy" completion descriptor use */
138− req_mgr_h->dummy_comp_buff = dma_alloc_coherent(&drvdata->plat_dev->dev,
139− sizeof(u32),
138+ req_mgr_h->dummy_comp_buff = dma_alloc_coherent(dev, sizeof(u32),
140139 &req_mgr_h->dummy_comp_buff_dma,
141140 GFP_KERNEL);
142141 if (!req_mgr_h->dummy_comp_buff) {
143− SSI_LOG_ERR("Not enough memory to allocate DMA (%zu) dropped "
144− "buffer\n", sizeof(u32));
142+ dev_err(dev, "Not enough memory to allocate DMA (%zu) dropped buffer\n",
143+ sizeof(u32));
145144 rc = -ENOMEM;
146145 goto req_mgr_init_err;
147146 }
@@ -168,17 +167,17 @@ static inline void enqueue_seq( · 20 unmodified lines
168167 int i;
169168
170169 for (i = 0; i < seq_len; i++) {
171− writel_relaxed(seq[i].word[0], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
172− writel_relaxed(seq[i].word[1], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
173− writel_relaxed(seq[i].word[2], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
174− writel_relaxed(seq[i].word[3], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
175− writel_relaxed(seq[i].word[4], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
170+ writel_relaxed(seq[i].word[0], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
171+ writel_relaxed(seq[i].word[1], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
172+ writel_relaxed(seq[i].word[2], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
173+ writel_relaxed(seq[i].word[3], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
174+ writel_relaxed(seq[i].word[4], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
176175 wmb();
177− writel_relaxed(seq[i].word[5], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0)));
176+ writel_relaxed(seq[i].word[5], (volatile void __iomem *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
178177 #ifdef DX_DUMP_DESCS
179− SSI_LOG_DEBUG("desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", i,
180− seq[i].word[0], seq[i].word[1], seq[i].word[2],
181− seq[i].word[3], seq[i].word[4], seq[i].word[5]);
178+ dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n",
179+ i, seq[i].word[0], seq[i].word[1], seq[i].word[2],
180+ seq[i].word[3], seq[i].word[4], seq[i].word[5]);
182181 #endif
183182 }
184183 }
@@ -198,11 +197,12 @@ static void request_mgr_complete(struct device *dev, void *dx_compl_h, void __io · 13 unmodified lines
198197 }
199198
200199 static inline int request_mgr_queues_status_check(
200+ struct ssi_drvdata *drvdata,
201201 struct ssi_request_mgr_handle *req_mgr_h,
202− void __iomem *cc_base,
203202 unsigned int total_seq_len)
204203 {
205204 unsigned long poll_queue;
205+ struct device *dev = drvdata_to_dev(drvdata);
206206
207207 /* SW queue is checked only once as it will not
208208 * be chaned during the poll becasue the spinlock_bh
@@ -211,8 +211,8 @@ static inline int request_mgr_queues_status_check( · 2 unmodified lines
211211 if (unlikely(((req_mgr_h->req_queue_head + 1) &
212212 (MAX_REQUEST_QUEUE_SIZE - 1)) ==
213213 req_mgr_h->req_queue_tail)) {
214− SSI_LOG_ERR("SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n",
215− req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE);
214+ dev_err(dev, "SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n",
215+ req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE);
216216 return -EBUSY;
217217 }
218218
@@ -222,8 +222,7 @@ static inline int request_mgr_queues_status_check( · 3 unmodified lines
222222 /* Wait for space in HW queue. Poll constant num of iterations. */
223223 for (poll_queue = 0; poll_queue < SSI_MAX_POLL_ITER ; poll_queue++) {
224224 req_mgr_h->q_free_slots =
225− CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL,
226− DSCRPTR_QUEUE_CONTENT));
225+ cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT));
227226 if (unlikely(req_mgr_h->q_free_slots <
228227 req_mgr_h->min_free_hw_slots)) {
229228 req_mgr_h->min_free_hw_slots = req_mgr_h->q_free_slots;
@@ -234,16 +233,13 @@ static inline int request_mgr_queues_status_check( · 4 unmodified lines
234233 return 0;
235234 }
236235
237− SSI_LOG_DEBUG("HW FIFO is full. q_free_slots=%d total_seq_len=%d\n",
238− req_mgr_h->q_free_slots, total_seq_len);
236+ dev_dbg(dev, "HW FIFO is full. q_free_slots=%d total_seq_len=%d\n",
237+ req_mgr_h->q_free_slots, total_seq_len);
239238 }
240239 /* No room in the HW queue try again later */
241− SSI_LOG_DEBUG("HW FIFO full, timeout. req_queue_head=%d "
242− "sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n",
243− req_mgr_h->req_queue_head,
244− MAX_REQUEST_QUEUE_SIZE,
245− req_mgr_h->q_free_slots,
246− total_seq_len);
240+ dev_dbg(dev, "HW FIFO full, timeout. req_queue_head=%d sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n",
241+ req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE,
242+ req_mgr_h->q_free_slots, total_seq_len);
247243 return -EAGAIN;
248244 }
249245
@@ -270,16 +266,17 @@ int send_request( · 20 unmodified lines
270266 unsigned int iv_seq_len = 0;
271267 unsigned int total_seq_len = len; /*initial sequence length*/
272268 struct cc_hw_desc iv_seq[SSI_IVPOOL_SEQ_LEN];
269+ struct device *dev = drvdata_to_dev(drvdata);
273270 int rc;
274271 unsigned int max_required_seq_len = (total_seq_len +
275272 ((ssi_req->ivgen_dma_addr_len == 0) ? 0 :
276273 SSI_IVPOOL_SEQ_LEN) +
277− ((is_dout == 0) ? 1 : 0));
274+ (!is_dout ? 1 : 0));
278275
279276 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
280− rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev);
277+ rc = ssi_power_mgr_runtime_get(dev);
281278 if (rc != 0) {
282− SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n", rc);
279+ dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc);
283280 return rc;
284281 }
285282 #endif
@@ -291,7 +288,7 @@ int send_request( · 5 unmodified lines
291288 * in case iv gen add the max size and in case of no dout add 1
292289 * for the internal completion descriptor
293290 */
294− rc = request_mgr_queues_status_check(req_mgr_h, cc_base,
291+ rc = request_mgr_queues_status_check(drvdata, req_mgr_h,
295292 max_required_seq_len);
296293 if (likely(rc == 0))
297294 /* There is enough place in the queue */
@@ -304,7 +301,7 @@ int send_request( · 6 unmodified lines
304301 * (SW queue is full)
305302 */
306303 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
307− ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev);
304+ ssi_power_mgr_runtime_put_suspend(dev);
308305 #endif
309306 return rc;
310307 }
@@ -324,12 +321,12 @@ int send_request( · 13 unmodified lines
324321 }
325322
326323 if (ssi_req->ivgen_dma_addr_len > 0) {
327− SSI_LOG_DEBUG("Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n",
328− ssi_req->ivgen_dma_addr_len,
329− ssi_req->ivgen_dma_addr[0],
330− ssi_req->ivgen_dma_addr[1],
331− ssi_req->ivgen_dma_addr[2],
332− ssi_req->ivgen_size);
324+ dev_dbg(dev, "Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n",
325+ ssi_req->ivgen_dma_addr_len,
326+ &ssi_req->ivgen_dma_addr[0],
327+ &ssi_req->ivgen_dma_addr[1],
328+ &ssi_req->ivgen_dma_addr[2],
329+ ssi_req->ivgen_size);
333330
334331 /* Acquire IV from pool */
335332 rc = ssi_ivgen_getiv(drvdata, ssi_req->ivgen_dma_addr,
@@ -337,10 +334,10 @@ int send_request( · 1 unmodified line
337334 ssi_req->ivgen_size, iv_seq, &iv_seq_len);
338335
339336 if (unlikely(rc != 0)) {
340− SSI_LOG_ERR("Failed to generate IV (rc=%d)\n", rc);
337+ dev_err(dev, "Failed to generate IV (rc=%d)\n", rc);
341338 spin_unlock_bh(&req_mgr_h->hw_lock);
342339 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
343− ssi_power_mgr_runtime_put_suspend(&drvdata->plat_dev->dev);
340+ ssi_power_mgr_runtime_put_suspend(dev);
344341 #endif
345342 return rc;
346343 }
@@ -357,7 +354,7 @@ int send_request( · 10 unmodified lines
357354 req_mgr_h->req_queue_head = (req_mgr_h->req_queue_head + 1) & (MAX_REQUEST_QUEUE_SIZE - 1);
358355 /* TODO: Use circ_buf.h ? */
359356
360− SSI_LOG_DEBUG("Enqueue request head=%u\n", req_mgr_h->req_queue_head);
357+ dev_dbg(dev, "Enqueue request head=%u\n", req_mgr_h->req_queue_head);
361358
362359 #ifdef FLUSH_CACHE_ALL
363360 flush_cache_all();
@@ -369,11 +366,16 @@ int send_request( · 5 unmodified lines
369366 enqueue_seq(cc_base, &req_mgr_h->compl_desc, (is_dout ? 0 : 1));
370367
371368 if (unlikely(req_mgr_h->q_free_slots < total_seq_len)) {
372− /*This means that there was a problem with the resume*/
373− BUG();
369+ /* This situation should never occur. Maybe indicating problem
370+ * with resuming power. Set the free slot count to 0 and hope
371+ * for the best.
372+ */
373+ dev_err(dev, "HW free slot count mismatch.");
374+ req_mgr_h->q_free_slots = 0;
375+ } else {
376+ /* Update the free slots in HW queue */
377+ req_mgr_h->q_free_slots -= total_seq_len;
374378 }
375− /* Update the free slots in HW queue */
376− req_mgr_h->q_free_slots -= total_seq_len;
377379
378380 spin_unlock_bh(&req_mgr_h->hw_lock);
379381
@@ -383,10 +385,9 @@ int send_request( · 3 unmodified lines
383385 */
384386 wait_for_completion(&ssi_req->seq_compl);
385387 return 0;
386− } else {
387− /* Operation still in process */
388− return -EINPROGRESS;
389388 }
389+ /* Operation still in process */
390+ return -EINPROGRESS;
390391 }
391392
392393 /*!
@@ -409,7 +410,8 @@ int send_request_init( · 16 unmodified lines
409410 int rc = 0;
410411
411412 /* Wait for space in HW and SW FIFO. Poll for as much as FIFO_TIMEOUT. */
412− rc = request_mgr_queues_status_check(req_mgr_h, cc_base, total_seq_len);
413+ rc = request_mgr_queues_status_check(drvdata, req_mgr_h,
414+ total_seq_len);
413415 if (unlikely(rc != 0))
414416 return rc;
415417
@@ -418,8 +420,8 @@ int send_request_init( · 2 unmodified lines
418420 enqueue_seq(cc_base, desc, len);
419421
420422 /* Update the free slots in HW queue */
421− req_mgr_h->q_free_slots = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL,
422− DSCRPTR_QUEUE_CONTENT));
423+ req_mgr_h->q_free_slots =
424+ cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT));
423425
424426 return 0;
425427 }
@@ -448,7 +450,7 @@ static void comp_work_handler(struct work_struct *work) · 22 unmodified lines
448450 static void proc_completions(struct ssi_drvdata *drvdata)
449451 {
450452 struct ssi_crypto_req *ssi_req;
451− struct platform_device *plat_dev = drvdata->plat_dev;
453+ struct device *dev = drvdata_to_dev(drvdata);
452454 struct ssi_request_mgr_handle *request_mgr_handle =
453455 drvdata->request_mgr_handle;
454456 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
@@ -460,8 +462,13 @@ static void proc_completions(struct ssi_drvdata *drvdata) · 5 unmodified lines
460462
461463 /* Dequeue request */
462464 if (unlikely(request_mgr_handle->req_queue_head == request_mgr_handle->req_queue_tail)) {
463− SSI_LOG_ERR("Request queue is empty req_queue_head==req_queue_tail==%u\n", request_mgr_handle->req_queue_head);
464− BUG();
465+ /* We are supposed to handle a completion but our
466+ * queue is empty. This is not normal. Return and
467+ * hope for the best.
468+ */
469+ dev_err(dev, "Request queue is empty head == tail %u\n",
470+ request_mgr_handle->req_queue_head);
471+ break;
465472 }
466473
467474 ssi_req = &request_mgr_handle->req_queue[request_mgr_handle->req_queue_tail];
@@ -476,39 +483,40 @@ static void proc_completions(struct ssi_drvdata *drvdata) · 8 unmodified lines
476483 u32 axi_err;
477484 int i;
478485
479− SSI_LOG_INFO("Delay\n");
486+ dev_info(dev, "Delay\n");
480487 for (i = 0; i < 1000000; i++)
481− axi_err = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR));
488+ axi_err = cc_ioread(drvdata,
489+ CC_REG(AXIM_MON_ERR));
482490 }
483491 #endif /* COMPLETION_DELAY */
484492
485493 if (likely(ssi_req->user_cb))
486− ssi_req->user_cb(&plat_dev->dev, ssi_req->user_arg, drvdata->cc_base);
494+ ssi_req->user_cb(dev, ssi_req->user_arg,
495+ drvdata->cc_base);
487496 request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1);
488− SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail);
489− SSI_LOG_DEBUG("Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed);
497+ dev_dbg(dev, "Dequeue request tail=%u\n",
498+ request_mgr_handle->req_queue_tail);
499+ dev_dbg(dev, "Request completed. axi_completed=%d\n",
500+ request_mgr_handle->axi_completed);
490501 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
491− rc = ssi_power_mgr_runtime_put_suspend(&plat_dev->dev);
502+ rc = ssi_power_mgr_runtime_put_suspend(dev);
492503 if (rc != 0)
493− SSI_LOG_ERR("Failed to set runtime suspension %d\n", rc);
504+ dev_err(dev, "Failed to set runtime suspension %d\n",
505+ rc);
494506 #endif
495507 }
496508 }
497509
498−static inline u32 cc_axi_comp_count(void __iomem *cc_base)
510+static inline u32 cc_axi_comp_count(struct ssi_drvdata *drvdata)
499511 {
500− /* The CC_HAL_READ_REGISTER macro implictly requires and uses
501− * a base MMIO register address variable named cc_base.
502− */
503512 return FIELD_GET(AXIM_MON_COMP_VALUE,
504− CC_HAL_READ_REGISTER(AXIM_MON_BASE_OFFSET));
513+ cc_ioread(drvdata, CC_REG(AXIM_MON_COMP)));
505514 }
506515
507516 /* Deferred service handler, run as interrupt-fired tasklet */
508517 static void comp_handler(unsigned long devarg)
509518 {
510519 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)devarg;
511− void __iomem *cc_base = drvdata->cc_base;
512520 struct ssi_request_mgr_handle *request_mgr_handle =
513521 drvdata->request_mgr_handle;
514522
@@ -517,12 +525,16 @@ static void comp_handler(unsigned long devarg) · 2 unmodified lines
517525 irq = (drvdata->irq & SSI_COMP_IRQ_MASK);
518526
519527 if (irq & SSI_COMP_IRQ_MASK) {
520− /* To avoid the interrupt from firing as we unmask it, we clear it now */
521− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK);
528+ /* To avoid the interrupt from firing as we unmask it,
529+ * we clear it now
530+ */
531+ cc_iowrite(drvdata, CC_REG(HOST_ICR), SSI_COMP_IRQ_MASK);
522532
523− /* Avoid race with above clear: Test completion counter once more */
533+ /* Avoid race with above clear: Test completion counter
534+ * once more
535+ */
524536 request_mgr_handle->axi_completed +=
525− cc_axi_comp_count(cc_base);
537+ cc_axi_comp_count(drvdata);
526538
527539 while (request_mgr_handle->axi_completed) {
528540 do {
@@ -531,20 +543,21 @@ static void comp_handler(unsigned long devarg) · 2 unmodified lines
531543 * request_mgr_handle->axi_completed is 0.
532544 */
533545 request_mgr_handle->axi_completed =
534− cc_axi_comp_count(cc_base);
546+ cc_axi_comp_count(drvdata);
535547 } while (request_mgr_handle->axi_completed > 0);
536548
537− /* To avoid the interrupt from firing as we unmask it, we clear it now */
538− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), SSI_COMP_IRQ_MASK);
549+ cc_iowrite(drvdata, CC_REG(HOST_ICR),
550+ SSI_COMP_IRQ_MASK);
539551
540− /* Avoid race with above clear: Test completion counter once more */
541552 request_mgr_handle->axi_completed +=
542− cc_axi_comp_count(cc_base);
553+ cc_axi_comp_count(drvdata);
543554 }
544555 }
545− /* after verifing that there is nothing to do, Unmask AXI completion interrupt */
546− CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR),
547− CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR)) & ~irq);
556+ /* after verifing that there is nothing to do,
557+ * unmask AXI completion interrupt
558+ */
559+ cc_iowrite(drvdata, CC_REG(HOST_IMR),
560+ cc_ioread(drvdata, CC_REG(HOST_IMR)) & ~irq);
548561 }
549562
550563 /*
drivers/staging/ccree/ssi_sram_mgr.c+10−23
@@ -50,28 +50,14 @@ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata) · 49 unmodified lines
5050 */
5151 int ssi_sram_mgr_init(struct ssi_drvdata *drvdata)
5252 {
53− struct ssi_sram_mgr_ctx *smgr_ctx;
54− int rc;
55−
5653 /* Allocate "this" context */
57− drvdata->sram_mgr_handle = kzalloc(
58− sizeof(struct ssi_sram_mgr_ctx), GFP_KERNEL);
59− if (!drvdata->sram_mgr_handle) {
60− SSI_LOG_ERR("Not enough memory to allocate SRAM_MGR ctx (%zu)\n",
61− sizeof(struct ssi_sram_mgr_ctx));
62− rc = -ENOMEM;
63− goto out;
64− }
65− smgr_ctx = drvdata->sram_mgr_handle;
54+ drvdata->sram_mgr_handle = kzalloc(sizeof(struct ssi_sram_mgr_ctx),
55+ GFP_KERNEL);
6656
67− /* Pool starts at start of SRAM */
68− smgr_ctx->sram_free_offset = 0;
57+ if (!drvdata->sram_mgr_handle)
58+ return -ENOMEM;
6959
7060 return 0;
71−
72−out:
73− ssi_sram_mgr_fini(drvdata);
74− return rc;
7561 }
7662
7763 /*!
@@ -86,22 +72,23 @@ out: · 8 unmodified lines
8672 ssi_sram_addr_t ssi_sram_mgr_alloc(struct ssi_drvdata *drvdata, u32 size)
8773 {
8874 struct ssi_sram_mgr_ctx *smgr_ctx = drvdata->sram_mgr_handle;
75+ struct device *dev = drvdata_to_dev(drvdata);
8976 ssi_sram_addr_t p;
9077
9178 if (unlikely((size & 0x3) != 0)) {
92− SSI_LOG_ERR("Requested buffer size (%u) is not multiple of 4",
93− size);
79+ dev_err(dev, "Requested buffer size (%u) is not multiple of 4",
80+ size);
9481 return NULL_SRAM_ADDR;
9582 }
9683 if (unlikely(size > (SSI_CC_SRAM_SIZE - smgr_ctx->sram_free_offset))) {
97− SSI_LOG_ERR("Not enough space to allocate %u B (at offset %llu)\n",
98− size, smgr_ctx->sram_free_offset);
84+ dev_err(dev, "Not enough space to allocate %u B (at offset %llu)\n",
85+ size, smgr_ctx->sram_free_offset);
9986 return NULL_SRAM_ADDR;
10087 }
10188
10289 p = smgr_ctx->sram_free_offset;
10390 smgr_ctx->sram_free_offset += size;
104− SSI_LOG_DEBUG("Allocated %u B @ %u\n", size, (unsigned int)p);
91+ dev_dbg(dev, "Allocated %u B @ %u\n", size, (unsigned int)p);
10592 return p;
10693 }
10794
drivers/staging/ccree/ssi_sysfs.c+8−274
@@ -24,277 +24,22 @@ · 23 unmodified lines
2424
2525 static struct ssi_drvdata *sys_get_drvdata(void);
2626
27−#ifdef CC_CYCLE_COUNT
28−
29−#include <asm/timex.h>
30−
31−struct stat_item {
32− unsigned int min;
33− unsigned int max;
34− cycles_t sum;
35− unsigned int count;
36−};
37−
38−struct stat_name {
39− const char *op_type_name;
40− const char *stat_phase_name[MAX_STAT_PHASES];
41−};
42−
43−static struct stat_name stat_name_db[MAX_STAT_OP_TYPES] = {
44− {
45− /* STAT_OP_TYPE_NULL */
46− .op_type_name = "NULL",
47− .stat_phase_name = {NULL},
48− },
49− {
50− .op_type_name = "Encode",
51− .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks",
52− .stat_phase_name[STAT_PHASE_1] = "Map buffers",
53− .stat_phase_name[STAT_PHASE_2] = "Create sequence",
54− .stat_phase_name[STAT_PHASE_3] = "Send Request",
55− .stat_phase_name[STAT_PHASE_4] = "HW-Q push",
56− .stat_phase_name[STAT_PHASE_5] = "Sequence completion",
57− .stat_phase_name[STAT_PHASE_6] = "HW cycles",
58− },
59− { .op_type_name = "Decode",
60− .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks",
61− .stat_phase_name[STAT_PHASE_1] = "Map buffers",
62− .stat_phase_name[STAT_PHASE_2] = "Create sequence",
63− .stat_phase_name[STAT_PHASE_3] = "Send Request",
64− .stat_phase_name[STAT_PHASE_4] = "HW-Q push",
65− .stat_phase_name[STAT_PHASE_5] = "Sequence completion",
66− .stat_phase_name[STAT_PHASE_6] = "HW cycles",
67− },
68− { .op_type_name = "Setkey",
69− .stat_phase_name[STAT_PHASE_0] = "Init and sanity checks",
70− .stat_phase_name[STAT_PHASE_1] = "Copy key to ctx",
71− .stat_phase_name[STAT_PHASE_2] = "Create sequence",
72− .stat_phase_name[STAT_PHASE_3] = "Send Request",
73− .stat_phase_name[STAT_PHASE_4] = "HW-Q push",
74− .stat_phase_name[STAT_PHASE_5] = "Sequence completion",
75− .stat_phase_name[STAT_PHASE_6] = "HW cycles",
76− },
77− {
78− .op_type_name = "Generic",
79− .stat_phase_name[STAT_PHASE_0] = "Interrupt",
80− .stat_phase_name[STAT_PHASE_1] = "ISR-to-Tasklet",
81− .stat_phase_name[STAT_PHASE_2] = "Tasklet start-to-end",
82− .stat_phase_name[STAT_PHASE_3] = "Tasklet:user_cb()",
83− .stat_phase_name[STAT_PHASE_4] = "Tasklet:dx_X_complete() - w/o X_complete()",
84− .stat_phase_name[STAT_PHASE_5] = "",
85− .stat_phase_name[STAT_PHASE_6] = "HW cycles",
86− }
87−};
88−
89−/*
90− * Structure used to create a directory
91− * and its attributes in sysfs.
92− */
93−struct sys_dir {
94− struct kobject *sys_dir_kobj;
95− struct attribute_group sys_dir_attr_group;
96− struct attribute **sys_dir_attr_list;
97− u32 num_of_attrs;
98− struct ssi_drvdata *drvdata; /* Associated driver context */
99−};
100−
101−/* top level directory structures */
102−struct sys_dir sys_top_dir;
103−
104−static DEFINE_SPINLOCK(stat_lock);
105−
106−/* List of DBs */
107−static struct stat_item stat_host_db[MAX_STAT_OP_TYPES][MAX_STAT_PHASES];
108−static struct stat_item stat_cc_db[MAX_STAT_OP_TYPES][MAX_STAT_PHASES];
109−
110−static void init_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES])
111−{
112− unsigned int i, j;
113−
114− /* Clear db */
115− for (i = 0; i < MAX_STAT_OP_TYPES; i++) {
116− for (j = 0; j < MAX_STAT_PHASES; j++) {
117− item[i][j].min = 0xFFFFFFFF;
118− item[i][j].max = 0;
119− item[i][j].sum = 0;
120− item[i][j].count = 0;
121− }
122− }
123−}
124−
125−static void update_db(struct stat_item *item, unsigned int result)
126−{
127− item->count++;
128− item->sum += result;
129− if (result < item->min)
130− item->min = result;
131− if (result > item->max)
132− item->max = result;
133−}
134−
135−static void display_db(struct stat_item item[MAX_STAT_OP_TYPES][MAX_STAT_PHASES])
136−{
137− unsigned int i, j;
138− u64 avg;
139−
140− for (i = STAT_OP_TYPE_ENCODE; i < MAX_STAT_OP_TYPES; i++) {
141− for (j = 0; j < MAX_STAT_PHASES; j++) {
142− if (item[i][j].count > 0) {
143− avg = (u64)item[i][j].sum;
144− do_div(avg, item[i][j].count);
145− SSI_LOG_ERR("%s, %s: min=%d avg=%d max=%d sum=%lld count=%d\n",
146− stat_name_db[i].op_type_name,
147− stat_name_db[i].stat_phase_name[j],
148− item[i][j].min, (int)avg,
149− item[i][j].max,
150− (long long)item[i][j].sum,
151− item[i][j].count);
152− }
153− }
154− }
155−}
156−
157−/**************************************
158− * Attributes show functions section *
159− **************************************/
160−
161−static ssize_t ssi_sys_stats_host_db_clear(struct kobject *kobj,
162− struct kobj_attribute *attr,
163− const char *buf, size_t count)
164−{
165− init_db(stat_host_db);
166− return count;
167−}
168−
169−static ssize_t ssi_sys_stats_cc_db_clear(struct kobject *kobj,
170− struct kobj_attribute *attr,
171− const char *buf, size_t count)
172−{
173− init_db(stat_cc_db);
174− return count;
175−}
176−
177−static ssize_t ssi_sys_stat_host_db_show(struct kobject *kobj,
178− struct kobj_attribute *attr, char *buf)
179−{
180− int i, j;
181− char line[512];
182− u32 min_cyc, max_cyc;
183− u64 avg;
184− ssize_t buf_len, tmp_len = 0;
185−
186− buf_len = scnprintf(buf, PAGE_SIZE,
187− "phase\t\t\t\t\t\t\tmin[cy]\tavg[cy]\tmax[cy]\t#samples\n");
188− if (buf_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/
189− return buf_len;
190− for (i = STAT_OP_TYPE_ENCODE; i < MAX_STAT_OP_TYPES; i++) {
191− for (j = 0; j < MAX_STAT_PHASES - 1; j++) {
192− if (stat_host_db[i][j].count > 0) {
193− avg = (u64)stat_host_db[i][j].sum;
194− do_div(avg, stat_host_db[i][j].count);
195− min_cyc = stat_host_db[i][j].min;
196− max_cyc = stat_host_db[i][j].max;
197− } else {
198− avg = min_cyc = max_cyc = 0;
199− }
200− tmp_len = scnprintf(line, 512,
201− "%s::%s\t\t\t\t\t%6u\t%6u\t%6u\t%7u\n",
202− stat_name_db[i].op_type_name,
203− stat_name_db[i].stat_phase_name[j],
204− min_cyc, (unsigned int)avg, max_cyc,
205− stat_host_db[i][j].count);
206− if (tmp_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/
207− return buf_len;
208− if (buf_len + tmp_len >= PAGE_SIZE)
209− return buf_len;
210− buf_len += tmp_len;
211− strncat(buf, line, 512);
212− }
213− }
214− return buf_len;
215−}
216−
217−static ssize_t ssi_sys_stat_cc_db_show(struct kobject *kobj,
218− struct kobj_attribute *attr, char *buf)
219−{
220− int i;
221− char line[256];
222− u32 min_cyc, max_cyc;
223− u64 avg;
224− ssize_t buf_len, tmp_len = 0;
225−
226− buf_len = scnprintf(buf, PAGE_SIZE,
227− "phase\tmin[cy]\tavg[cy]\tmax[cy]\t#samples\n");
228− if (buf_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/
229− return buf_len;
230− for (i = STAT_OP_TYPE_ENCODE; i < MAX_STAT_OP_TYPES; i++) {
231− if (stat_cc_db[i][STAT_PHASE_6].count > 0) {
232− avg = (u64)stat_cc_db[i][STAT_PHASE_6].sum;
233− do_div(avg, stat_cc_db[i][STAT_PHASE_6].count);
234− min_cyc = stat_cc_db[i][STAT_PHASE_6].min;
235− max_cyc = stat_cc_db[i][STAT_PHASE_6].max;
236− } else {
237− avg = min_cyc = max_cyc = 0;
238− }
239− tmp_len = scnprintf(line, 256, "%s\t%6u\t%6u\t%6u\t%7u\n",
240− stat_name_db[i].op_type_name, min_cyc,
241− (unsigned int)avg, max_cyc,
242− stat_cc_db[i][STAT_PHASE_6].count);
243−
244− if (tmp_len < 0)/* scnprintf shouldn't return negative value according to its implementation*/
245− return buf_len;
246−
247− if (buf_len + tmp_len >= PAGE_SIZE)
248− return buf_len;
249− buf_len += tmp_len;
250− strncat(buf, line, 256);
251− }
252− return buf_len;
253−}
254−
255−void update_host_stat(unsigned int op_type, unsigned int phase, cycles_t result)
256−{
257− unsigned long flags;
258−
259− spin_lock_irqsave(&stat_lock, flags);
260− update_db(&stat_host_db[op_type][phase], (unsigned int)result);
261− spin_unlock_irqrestore(&stat_lock, flags);
262−}
263−
264−void update_cc_stat(
265− unsigned int op_type,
266− unsigned int phase,
267− unsigned int elapsed_cycles)
268−{
269− update_db(&stat_cc_db[op_type][phase], elapsed_cycles);
270−}
271−
272−void display_all_stat_db(void)
273−{
274− SSI_LOG_ERR("\n======= CYCLE COUNT STATS =======\n");
275− display_db(stat_host_db);
276− SSI_LOG_ERR("\n======= CC HW CYCLE COUNT STATS =======\n");
277− display_db(stat_cc_db);
278−}
279−#endif /*CC_CYCLE_COUNT*/
280−
28127 static ssize_t ssi_sys_regdump_show(struct kobject *kobj,
28228 struct kobj_attribute *attr, char *buf)
28329 {
28430 struct ssi_drvdata *drvdata = sys_get_drvdata();
28531 u32 register_value;
286− void __iomem *cc_base = drvdata->cc_base;
28732 int offset = 0;
28833
289− register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_SIGNATURE));
34+ register_value = cc_ioread(drvdata, CC_REG(HOST_SIGNATURE));
29035 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_SIGNATURE ", DX_HOST_SIGNATURE_REG_OFFSET, register_value);
291− register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR));
36+ register_value = cc_ioread(drvdata, CC_REG(HOST_IRR));
29237 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_IRR ", DX_HOST_IRR_REG_OFFSET, register_value);
293− register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_POWER_DOWN_EN));
38+ register_value = cc_ioread(drvdata, CC_REG(HOST_POWER_DOWN_EN));
29439 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "HOST_POWER_DOWN_EN ", DX_HOST_POWER_DOWN_EN_REG_OFFSET, register_value);
295− register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR));
40+ register_value = cc_ioread(drvdata, CC_REG(AXIM_MON_ERR));
29641 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "AXIM_MON_ERR ", DX_AXIM_MON_ERR_REG_OFFSET, register_value);
297− register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_CONTENT));
42+ register_value = cc_ioread(drvdata, CC_REG(DSCRPTR_QUEUE_CONTENT));
29843 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 0x%08X\n", "DSCRPTR_QUEUE_CONTENT", DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET, register_value);
29944 return offset;
30045 }
@@ -304,12 +49,6 @@ static ssize_t ssi_sys_help_show(struct kobject *kobj, · 3 unmodified lines
30449 {
30550 char *help_str[] = {
30651 "cat reg_dump ", "Print several of CC register values",
307− #if defined CC_CYCLE_COUNT
308− "cat stats_host ", "Print host statistics",
309− "echo <number> > stats_host", "Clear host statistics database",
310− "cat stats_cc ", "Print CC statistics",
311− "echo <number> > stats_cc ", "Clear CC statistics database",
312− #endif
31352 };
31453 int i = 0, offset = 0;
31554
@@ -376,7 +115,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata, · 60 unmodified lines
376115 return -ENOMEM;
377116 /* allocate memory for directory's attributes list */
378117 sys_dir->sys_dir_attr_list =
379− kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
118+ kcalloc(num_of_attrs + 1, sizeof(struct attribute *),
380119 GFP_KERNEL);
381120
382121 if (!(sys_dir->sys_dir_attr_list)) {
@@ -413,14 +152,9 @@ static void sys_free_dir(struct sys_dir *sys_dir) · 30 unmodified lines
413152 int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata)
414153 {
415154 int retval;
155+ struct device *dev = drvdata_to_dev(drvdata);
416156
417−#if defined CC_CYCLE_COUNT
418− /* Init. statistics */
419− init_db(stat_host_db);
420− init_db(stat_cc_db);
421−#endif
422−
423− SSI_LOG_ERR("setup sysfs under %s\n", sys_dev_obj->name);
157+ dev_info(dev, "setup sysfs under %s\n", sys_dev_obj->name);
424158
425159 /* Initialize top directory */
426160 retval = sys_init_dir(&sys_top_dir, drvdata, sys_dev_obj, "cc_info",
drivers/staging/comedi/Kconfig+2−2
@@ -785,8 +785,8 @@ config COMEDI_ADV_PCI_DIO · 784 unmodified lines
785785 ---help---
786786 Enable support for Advantech PCI DIO cards
787787 PCI-1730, PCI-1733, PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U,
788− PCI-1750, PCI-1751, PCI-1752, PCI-1753/E, PCI-1754, PCI-1756 and
789− PCI-1762
788+ PCI-1750, PCI-1751, PCI-1752, PCI-1753/E, PCI-1754, PCI-1756,
789+ PCI-1761 and PCI-1762
790790
791791 To compile this driver as a module, choose M here: the module will be
792792 called adv_pci_dio.
drivers/staging/comedi/drivers/adv_pci_dio.c+24−2
@@ -12,9 +12,9 @@ · 11 unmodified lines
1212 * Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733,
1313 * PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750,
1414 * PCI-1751, PCI-1752, PCI-1753, PCI-1753+PCI-1753E,
15− * PCI-1754, PCI-1756, PCI-1762
15+ * PCI-1754, PCI-1756, PCI-1761, PCI-1762
1616 * Author: Michal Dobes <dobes@tesnet.cz>
17− * Updated: Mon, 09 Jan 2012 12:40:46 +0000
17+ * Updated: Fri, 25 Aug 2017 07:23:06 +0300
1818 * Status: untested
1919 *
2020 * Configuration Options: not applicable, uses PCI auto config
@@ -50,6 +50,11 @@ · 29 unmodified lines
5050 /* PCI-1752, PCI-1756 special registers */
5151 #define PCI1752_CFC_REG 0x12 /* R/W: channel freeze function */
5252
53+/* PCI-1761 interrupt control registers */
54+#define PCI1761_INT_EN_REG 0x03 /* R/W: enable/disable interrupts */
55+#define PCI1761_INT_RF_REG 0x04 /* R/W: falling/rising edge */
56+#define PCI1761_INT_CLR_REG 0x05 /* R/W: clear interrupts */
57+
5358 /* PCI-1762 interrupt control registers */
5459 #define PCI1762_INT_REG 0x06 /* R/W: status/control */
5560
@@ -72,6 +77,7 @@ enum pci_dio_boardid { · 16 unmodified lines
7277 TYPE_PCI1753E,
7378 TYPE_PCI1754,
7479 TYPE_PCI1756,
80+ TYPE_PCI1761,
7581 TYPE_PCI1762
7682 };
7783
@@ -181,6 +187,13 @@ static const struct dio_boardtype boardtypes[] = { · 103 unmodified lines
181187 .id_reg = 0x10,
182188 .is_16bit = 1,
183189 },
190+ [TYPE_PCI1761] = {
191+ .name = "pci1761",
192+ .nsubdevs = 3,
193+ .sdi[1] = { 8, 0x01 }, /* ISO DI 0-7 */
194+ .sdo[1] = { 8, 0x00 }, /* RELAY DO 0-7 */
195+ .id_reg = 0x02,
196+ },
184197 [TYPE_PCI1762] = {
185198 .name = "pci1762",
186199 .nsubdevs = 3,
@@ -309,6 +322,14 @@ static int pci_dio_reset(struct comedi_device *dev, unsigned long cardtype) · 122 unmodified lines
309322 outw(0x08, dev->iobase + PCI1754_INT_REG(3));
310323 }
311324 break;
325+ case TYPE_PCI1761:
326+ /* disable interrupts */
327+ outb(0, dev->iobase + PCI1761_INT_EN_REG);
328+ /* clear interrupts */
329+ outb(0xff, dev->iobase + PCI1761_INT_CLR_REG);
330+ /* set rising edge trigger */
331+ outb(0, dev->iobase + PCI1761_INT_RF_REG);
332+ break;
312333 case TYPE_PCI1762:
313334 outw(0x0101, dev->iobase + PCI1762_INT_REG);
314335 break;
@@ -496,6 +517,7 @@ static const struct pci_device_id adv_pci_dio_pci_table[] = { · 181 unmodified lines
496517 { PCI_VDEVICE(ADVANTECH, 0x1753), TYPE_PCI1753 },
497518 { PCI_VDEVICE(ADVANTECH, 0x1754), TYPE_PCI1754 },
498519 { PCI_VDEVICE(ADVANTECH, 0x1756), TYPE_PCI1756 },
520+ { PCI_VDEVICE(ADVANTECH, 0x1761), TYPE_PCI1761 },
499521 { PCI_VDEVICE(ADVANTECH, 0x1762), TYPE_PCI1762 },
500522 { 0 }
501523 };
drivers/staging/comedi/drivers/comedi_test.c+10−8
@@ -93,6 +93,7 @@ struct waveform_private { · 92 unmodified lines
9393 unsigned int ai_scan_period; /* AI scan period in usec */
9494 unsigned int ai_convert_period; /* AI conversion period in usec */
9595 struct timer_list ao_timer; /* timer for AO commands */
96+ struct comedi_device *dev; /* parent comedi device */
9697 u64 ao_last_scan_time; /* time of previous AO scan in usec */
9798 unsigned int ao_scan_period; /* AO scan period in usec */
9899 unsigned short ao_loopbacks[N_CHANS];
@@ -201,10 +202,10 @@ static unsigned short fake_waveform(struct comedi_device *dev, · 102 unmodified lines
201202 * It should run in the background; therefore it is scheduled by
202203 * a timer mechanism.
203204 */
204−static void waveform_ai_timer(unsigned long arg)
205+static void waveform_ai_timer(struct timer_list *t)
205206 {
206− struct comedi_device *dev = (struct comedi_device *)arg;
207− struct waveform_private *devpriv = dev->private;
207+ struct waveform_private *devpriv = from_timer(devpriv, t, ai_timer);
208+ struct comedi_device *dev = devpriv->dev;
208209 struct comedi_subdevice *s = dev->read_subdev;
209210 struct comedi_async *async = s->async;
210211 struct comedi_cmd *cmd = &async->cmd;
@@ -438,10 +439,10 @@ static int waveform_ai_insn_read(struct comedi_device *dev, · 227 unmodified lines
438439 * This is the background routine to handle AO commands, scheduled by
439440 * a timer mechanism.
440441 */
441−static void waveform_ao_timer(unsigned long arg)
442+static void waveform_ao_timer(struct timer_list *t)
442443 {
443− struct comedi_device *dev = (struct comedi_device *)arg;
444− struct waveform_private *devpriv = dev->private;
444+ struct waveform_private *devpriv = from_timer(devpriv, t, ao_timer);
445+ struct comedi_device *dev = devpriv->dev;
445446 struct comedi_subdevice *s = dev->write_subdev;
446447 struct comedi_async *async = s->async;
447448 struct comedi_cmd *cmd = &async->cmd;
@@ -686,8 +687,9 @@ static int waveform_common_attach(struct comedi_device *dev, · 238 unmodified lines
686687 for (i = 0; i < s->n_chan; i++)
687688 devpriv->ao_loopbacks[i] = s->maxdata / 2;
688689
689− setup_timer(&devpriv->ai_timer, waveform_ai_timer, (unsigned long)dev);
690− setup_timer(&devpriv->ao_timer, waveform_ao_timer, (unsigned long)dev);
690+ devpriv->dev = dev;
691+ timer_setup(&devpriv->ai_timer, waveform_ai_timer, 0);
692+ timer_setup(&devpriv->ao_timer, waveform_ao_timer, 0);
691693
692694 dev_info(dev->class_dev,
693695 "%s: %u microvolt, %u microsecond waveform attached\n",
drivers/staging/comedi/drivers/das16.c+8−9
@@ -440,6 +440,7 @@ static inline int timer_period(void) · 439 unmodified lines
440440
441441 struct das16_private_struct {
442442 struct comedi_isadma *dma;
443+ struct comedi_device *dev;
443444 unsigned int clockbase;
444445 unsigned int ctrl_reg;
445446 unsigned int divisor1;
@@ -525,10 +526,10 @@ static void das16_interrupt(struct comedi_device *dev) · 79 unmodified lines
525526 comedi_handle_events(dev, s);
526527 }
527528
528−static void das16_timer_interrupt(unsigned long arg)
529+static void das16_timer_interrupt(struct timer_list *t)
529530 {
530− struct comedi_device *dev = (struct comedi_device *)arg;
531− struct das16_private_struct *devpriv = dev->private;
531+ struct das16_private_struct *devpriv = from_timer(devpriv, t, timer);
532+ struct comedi_device *dev = devpriv->dev;
532533 unsigned long flags;
533534
534535 das16_interrupt(dev);
@@ -934,6 +935,8 @@ static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) · 399 unmodified lines
934935 {
935936 struct das16_private_struct *devpriv = dev->private;
936937
938+ timer_setup(&devpriv->timer, das16_timer_interrupt, 0);
939+
937940 /* only DMA channels 3 and 1 are valid */
938941 if (!(dma_chan == 1 || dma_chan == 3))
939942 return;
@@ -941,10 +944,6 @@ static void das16_alloc_dma(struct comedi_device *dev, unsigned int dma_chan) · 1 unmodified line
941944 /* DMA uses two buffers */
942945 devpriv->dma = comedi_isadma_alloc(dev, 2, dma_chan, dma_chan,
943946 DAS16_DMA_SIZE, COMEDI_ISADMA_READ);
944− if (devpriv->dma) {
945− setup_timer(&devpriv->timer, das16_timer_interrupt,
946− (unsigned long)dev);
947− }
948947 }
949948
950949 static void das16_free_dma(struct comedi_device *dev)
@@ -952,8 +951,7 @@ static void das16_free_dma(struct comedi_device *dev) · 1 unmodified line
952951 struct das16_private_struct *devpriv = dev->private;
953952
954953 if (devpriv) {
955− if (devpriv->timer.data)
956− del_timer_sync(&devpriv->timer);
954+ del_timer_sync(&devpriv->timer);
957955 comedi_isadma_free(devpriv->dma);
958956 }
959957 }
@@ -1046,6 +1044,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) · 86 unmodified lines
10461044 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
10471045 if (!devpriv)
10481046 return -ENOMEM;
1047+ devpriv->dev = dev;
10491048
10501049 if (board->size < 0x400) {
10511050 ret = comedi_request_region(dev, it->options[0], board->size);
drivers/staging/comedi/drivers/dt282x.c+2−0
@@ -1062,6 +1062,8 @@ static void dt282x_alloc_dma(struct comedi_device *dev, · 1061 unmodified lines
10621062 PAGE_SIZE, 0);
10631063 if (!devpriv->dma)
10641064 free_irq(irq_num, dev);
1065+ else
1066+ dev->irq = irq_num;
10651067 }
10661068
10671069 static void dt282x_free_dma(struct comedi_device *dev)
drivers/staging/comedi/drivers/jr3_pci.c+6−4
@@ -96,6 +96,7 @@ struct jr3_pci_poll_delay { · 95 unmodified lines
9696
9797 struct jr3_pci_dev_private {
9898 struct timer_list timer;
99+ struct comedi_device *dev;
99100 };
100101
101102 union jr3_pci_single_range {
@@ -585,10 +586,10 @@ jr3_pci_poll_subdevice(struct comedi_subdevice *s) · 483 unmodified lines
585586 return result;
586587 }
587588
588−static void jr3_pci_poll_dev(unsigned long data)
589+static void jr3_pci_poll_dev(struct timer_list *t)
589590 {
590− struct comedi_device *dev = (struct comedi_device *)data;
591− struct jr3_pci_dev_private *devpriv = dev->private;
591+ struct jr3_pci_dev_private *devpriv = from_timer(devpriv, t, timer);
592+ struct comedi_device *dev = devpriv->dev;
592593 struct jr3_pci_subdev_private *spriv;
593594 struct comedi_subdevice *s;
594595 unsigned long flags;
@@ -770,7 +771,8 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, · 175 unmodified lines
770771 spriv->next_time_min = jiffies + msecs_to_jiffies(500);
771772 }
772773
773− setup_timer(&devpriv->timer, jr3_pci_poll_dev, (unsigned long)dev);
774+ devpriv->dev = dev;
775+ timer_setup(&devpriv->timer, jr3_pci_poll_dev, 0);
774776 devpriv->timer.expires = jiffies + msecs_to_jiffies(1000);
775777 add_timer(&devpriv->timer);
776778
drivers/staging/comedi/drivers/s526.c+2−3
@@ -408,9 +408,8 @@ static int s526_gpct_winsn(struct comedi_device *dev, · 407 unmodified lines
408408 */
409409 if ((data[1] <= data[0]) || !data[0])
410410 return -EINVAL;
411−
412− /* Fall thru to write the PULSE_WIDTH */
413−
411+ /* to write the PULSE_WIDTH */
412+ /* fall through */
414413 case INSN_CONFIG_GPCT_QUADRATURE_ENCODER:
415414 case INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR:
416415 s526_gpct_write(dev, chan, data[0]);
drivers/staging/dgnc/dgnc_driver.c+3−5
@@ -291,7 +291,7 @@ static void dgnc_free_irq(struct dgnc_board *brd) · 290 unmodified lines
291291 * waiter needs to be woken up, and (b) whether the poller needs to
292292 * be rescheduled.
293293 */
294−static void dgnc_poll_handler(ulong dummy)
294+static void dgnc_poll_handler(struct timer_list *unused)
295295 {
296296 struct dgnc_board *brd;
297297 unsigned long flags;
@@ -323,7 +323,7 @@ static void dgnc_poll_handler(ulong dummy) · 25 unmodified lines
323323 if ((ulong)new_time >= 2 * dgnc_poll_tick)
324324 dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
325325
326− setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
326+ timer_setup(&dgnc_poll_timer, dgnc_poll_handler, 0);
327327 dgnc_poll_timer.expires = dgnc_poll_time;
328328 spin_unlock_irqrestore(&dgnc_poll_lock, flags);
329329
@@ -392,8 +392,6 @@ static int dgnc_start(void) · 62 unmodified lines
392392 unsigned long flags;
393393 struct device *dev;
394394
395− init_timer(&dgnc_poll_timer);
396−
397395 rc = register_chrdev(0, "dgnc", &dgnc_board_fops);
398396 if (rc < 0) {
399397 pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
@@ -419,7 +417,7 @@ static int dgnc_start(void) · 19 unmodified lines
419417
420418 /* Start the poller */
421419 spin_lock_irqsave(&dgnc_poll_lock, flags);
422− setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
420+ timer_setup(&dgnc_poll_timer, dgnc_poll_handler, 0);
423421 dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
424422 dgnc_poll_timer.expires = dgnc_poll_time;
425423 spin_unlock_irqrestore(&dgnc_poll_lock, flags);
drivers/staging/dgnc/dgnc_driver.h+0−16
@@ -104,7 +104,6 @@ struct board_ops { · 103 unmodified lines
104104 * struct dgnc_board - Per board information.
105105 * @boardnum: Board number (0 - 32).
106106 *
107− * @type: Type of board.
108107 * @name: Product name.
109108 * @pdev: Pointer to the pci_dev structure.
110109 * @bd_flags: Board flags.
@@ -140,13 +139,9 @@ struct board_ops { · 29 unmodified lines
140139 * @dpastatus: Board status as defined by DPA.
141140 * @bd_dividend: Board/UART's specific dividend.
142141 * @bd_ops: Pointer to board operations structure.
143− * @proc_entry_pointer: Proc/<board> entry
144− * @dgnc_board_table: Proc/<board> entry
145142 */
146143 struct dgnc_board {
147144 int boardnum;
148−
149− int type;
150145 char *name;
151146 struct pci_dev *pdev;
152147 unsigned long bd_flags;
@@ -200,10 +195,6 @@ struct dgnc_board { · 47 unmodified lines
200195 uint bd_dividend;
201196
202197 struct board_ops *bd_ops;
203−
204− struct proc_dir_entry *proc_entry_pointer;
205− struct dgnc_proc_entry *dgnc_board_table;
206−
207198 };
208199
209200 /* Unit flag definitions for un_flags. */
@@ -233,7 +224,6 @@ struct device; · 23 unmodified lines
233224 */
234225 struct un_t {
235226 struct channel_t *un_ch;
236− ulong un_time;
237227 uint un_type;
238228 uint un_open_count;
239229 struct tty_struct *un_tty;
@@ -321,8 +311,6 @@ struct un_t { · 81 unmodified lines
321311 * @ch_err_overrun: Count of overruns on channel.
322312 * @ch_xon_sends: Count of xons transmitted.
323313 * @ch_xoff_sends: Count of xoffs transmitted.
324− * @proc_entry_pointer: Proc/<board>/<channel> entry.
325− * @dgnc_channel_table: Proc/<board>/<channel> entry.
326314 */
327315 struct channel_t {
328316 struct dgnc_board *ch_bd;
@@ -391,10 +379,6 @@ struct channel_t { · 62 unmodified lines
391379
392380 ulong ch_xon_sends;
393381 ulong ch_xoff_sends;
394−
395− struct proc_dir_entry *proc_entry_pointer;
396− struct dgnc_proc_entry *dgnc_channel_table;
397−
398382 };
399383
400384 extern uint dgnc_major; /* Our driver/mgmt major */
drivers/staging/dgnc/dgnc_neo.c+4−7
@@ -1182,7 +1182,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds) · 1181 unmodified lines
11821182 unsigned long flags;
11831183 struct channel_t *ch;
11841184 struct un_t *un;
1185− int rc = 0;
11861185
11871186 if (!tty)
11881187 return -ENXIO;
@@ -1199,12 +1198,10 @@ static int neo_drain(struct tty_struct *tty, uint seconds) · 10 unmodified lines
11991198 un->un_flags |= UN_EMPTY;
12001199 spin_unlock_irqrestore(&ch->ch_lock, flags);
12011200
1202− rc = wait_event_interruptible_timeout(un->un_flags_wait,
1203− ((un->un_flags & UN_EMPTY) == 0),
1204− msecs_to_jiffies(seconds * 1000));
1205−
1206− /* If ret is non-zero, user ctrl-c'ed us */
1207− return rc;
1201+ /* If returned value is non-zero, user ctrl-c'ed us */
1202+ return wait_event_interruptible_timeout(un->un_flags_wait,
1203+ ((un->un_flags & UN_EMPTY) == 0),
1204+ msecs_to_jiffies(seconds * 1000));
12081205 }
12091206
12101207 /*
drivers/staging/fbtft/fb_ra8875.c+5−5
@@ -253,7 +253,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) · 252 unmodified lines
253253 static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
254254 {
255255 u16 *vmem16;
256− __be16 *txbuf16 = par->txbuf.buf;
256+ __be16 *txbuf16;
257257 size_t remain;
258258 size_t to_copy;
259259 size_t tx_array_size;
@@ -267,10 +267,10 @@ static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) · 7 unmodified lines
267267 remain = len / 2;
268268 vmem16 = (u16 *)(par->info->screen_buffer + offset);
269269 tx_array_size = par->txbuf.len / 2;
270− txbuf16 = par->txbuf.buf + 1;
271− tx_array_size -= 2;
272− *(u8 *)(par->txbuf.buf) = 0x00;
273− startbyte_size = 1;
270+ txbuf16 = par->txbuf.buf + 1;
271+ tx_array_size -= 2;
272+ *(u8 *)(par->txbuf.buf) = 0x00;
273+ startbyte_size = 1;
274274
275275 while (remain) {
276276 to_copy = min(tx_array_size, remain);
drivers/staging/fbtft/fb_ssd1331.c+7−1
@@ -26,7 +26,13 @@ static int init_display(struct fbtft_par *par) · 25 unmodified lines
2626 par->fbtftops.reset(par);
2727
2828 write_reg(par, 0xae); /* Display Off */
29− write_reg(par, 0xa0, 0x70 | (par->bgr << 2)); /* Set Colour Depth */
29+
30+ /* Set Column Address Mapping, COM Scan Direction and Colour Depth */
31+ if (par->info->var.rotate == 180)
32+ write_reg(par, 0xa0, 0x60 | (par->bgr << 2));
33+ else
34+ write_reg(par, 0xa0, 0x72 | (par->bgr << 2));
35+
3036 write_reg(par, 0x72); /* RGB colour */
3137 write_reg(par, 0xa1, 0x00); /* Set Display Start Line */
3238 write_reg(par, 0xa2, 0x00); /* Set Display Offset */
drivers/staging/fbtft/fb_uc1611.c+1−1
@@ -225,7 +225,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) · 224 unmodified lines
225225 u8 *buf8 = par->txbuf.buf;
226226 u16 *buf16 = par->txbuf.buf;
227227 int line_length = par->info->fix.line_length;
228− int y_start = (offset / line_length);
228+ int y_start = offset / line_length;
229229 int y_end = (offset + len - 1) / line_length;
230230 int x, y, i;
231231 int ret = 0;
drivers/staging/fbtft/fb_uc1701.c+1−1
@@ -127,7 +127,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) · 126 unmodified lines
127127 static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
128128 {
129129 u16 *vmem16 = (u16 *)par->info->screen_buffer;
130− u8 *buf = par->txbuf.buf;
130+ u8 *buf;
131131 int x, y, i;
132132 int ret = 0;
133133
drivers/staging/fbtft/fbtft-bus.c+12−12
@@ -11,33 +11,33 @@ · 10 unmodified lines
1111 *
1212 *****************************************************************************/
1313
14−#define define_fbtft_write_reg(func, type, modifier) \
14+#define define_fbtft_write_reg(func, buffer_type, data_type, modifier) \
1515 void func(struct fbtft_par *par, int len, ...) \
1616 { \
1717 va_list args; \
1818 int i, ret; \
1919 int offset = 0; \
20− type *buf = (type *)par->buf; \
20+ buffer_type *buf = (buffer_type *)par->buf; \
2121 \
2222 if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { \
2323 va_start(args, len); \
2424 for (i = 0; i < len; i++) { \
25− buf[i] = (type)va_arg(args, unsigned int); \
25+ buf[i] = modifier((data_type)va_arg(args, unsigned int)); \
2626 } \
2727 va_end(args); \
28− fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, type, buf, len, "%s: ", __func__); \
28+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, buffer_type, buf, len, "%s: ", __func__); \
2929 } \
3030 \
3131 va_start(args, len); \
3232 \
3333 if (par->startbyte) { \
3434 *(u8 *)par->buf = par->startbyte; \
35− buf = (type *)(par->buf + 1); \
35+ buf = (buffer_type *)(par->buf + 1); \
3636 offset = 1; \
3737 } \
3838 \
39− *buf = modifier((type)va_arg(args, unsigned int)); \
40− ret = fbtft_write_buf_dc(par, par->buf, sizeof(type) + offset, 0); \
39+ *buf = modifier((data_type)va_arg(args, unsigned int)); \
40+ ret = fbtft_write_buf_dc(par, par->buf, sizeof(data_type) + offset, 0); \
4141 if (ret < 0) \
4242 goto out; \
4343 len--; \
@@ -48,18 +48,18 @@ void func(struct fbtft_par *par, int len, ...) \ · 4 unmodified lines
4848 if (len) { \
4949 i = len; \
5050 while (i--) \
51− *buf++ = modifier((type)va_arg(args, unsigned int)); \
51+ *buf++ = modifier((data_type)va_arg(args, unsigned int)); \
5252 fbtft_write_buf_dc(par, par->buf, \
53− len * (sizeof(type) + offset), 1); \
53+ len * (sizeof(data_type) + offset), 1); \
5454 } \
5555 out: \
5656 va_end(args); \
5757 } \
5858 EXPORT_SYMBOL(func);
5959
60−define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, )
61−define_fbtft_write_reg(fbtft_write_reg16_bus8, u16, cpu_to_be16)
62−define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, )
60+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
61+define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
62+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
6363
6464 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
6565 {
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c+166−115
@@ -104,9 +104,11 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv, · 103 unmodified lines
104104 /* We don't support any other format */
105105 return;
106106
107− /* For S/G frames, we first need to free all SG entries */
107+ /* For S/G frames, we first need to free all SG entries
108+ * except the first one, which was taken care of already
109+ */
108110 sgt = vaddr + dpaa2_fd_get_offset(fd);
109− for (i = 0; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
111+ for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
110112 addr = dpaa2_sg_get_addr(&sgt[i]);
111113 sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
112114 dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
@@ -131,16 +133,15 @@ static struct sk_buff *build_linear_skb(struct dpaa2_eth_priv *priv, · 18 unmodified lines
131133 u16 fd_offset = dpaa2_fd_get_offset(fd);
132134 u32 fd_length = dpaa2_fd_get_len(fd);
133135
134− skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
135− SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
136+ ch->buf_count--;
137+
138+ skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
136139 if (unlikely(!skb))
137140 return NULL;
138141
139142 skb_reserve(skb, fd_offset);
140143 skb_put(skb, fd_length);
141144
142− ch->buf_count--;
143−
144145 return skb;
145146 }
146147
@@ -176,10 +177,21 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, · 29 unmodified lines
176177
177178 if (i == 0) {
178179 /* We build the skb around the first data buffer */
179− skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
180− SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
181− if (unlikely(!skb))
182− return NULL;
180+ skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
181+ if (unlikely(!skb)) {
182+ /* Free the first SG entry now, since we already
183+ * unmapped it and obtained the virtual address
184+ */
185+ skb_free_frag(sg_vaddr);
186+
187+ /* We still need to subtract the buffers used
188+ * by this FD from our software counter
189+ */
190+ while (!dpaa2_sg_is_final(&sgt[i]) &&
191+ i < DPAA2_ETH_MAX_SG_ENTRIES)
192+ i++;
193+ break;
194+ }
183195
184196 sg_offset = dpaa2_sg_get_offset(sge);
185197 skb_reserve(skb, sg_offset);
@@ -206,6 +218,8 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv, · 20 unmodified lines
206218 break;
207219 }
208220
221+ WARN_ONCE(i == DPAA2_ETH_MAX_SG_ENTRIES, "Final bit not set in SGT");
222+
209223 /* Count all data buffers + SG table buffer */
210224 ch->buf_count -= i + 2;
211225
@@ -557,10 +571,10 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev) · 345 unmodified lines
557571 percpu_stats = this_cpu_ptr(priv->percpu_stats);
558572 percpu_extras = this_cpu_ptr(priv->percpu_extras);
559573
560− if (unlikely(skb_headroom(skb) < DPAA2_ETH_NEEDED_HEADROOM(priv))) {
574+ if (unlikely(skb_headroom(skb) < dpaa2_eth_needed_headroom(priv))) {
561575 struct sk_buff *ns;
562576
563− ns = skb_realloc_headroom(skb, DPAA2_ETH_NEEDED_HEADROOM(priv));
577+ ns = skb_realloc_headroom(skb, dpaa2_eth_needed_headroom(priv));
564578 if (unlikely(!ns)) {
565579 percpu_stats->tx_dropped++;
566580 goto err_alloc_headroom;
@@ -718,6 +732,23 @@ static int set_tx_csum(struct dpaa2_eth_priv *priv, bool enable) · 151 unmodified lines
718732 return 0;
719733 }
720734
735+/* Free buffers acquired from the buffer pool or which were meant to
736+ * be released in the pool
737+ */
738+static void free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, int count)
739+{
740+ struct device *dev = priv->net_dev->dev.parent;
741+ void *vaddr;
742+ int i;
743+
744+ for (i = 0; i < count; i++) {
745+ vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]);
746+ dma_unmap_single(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE,
747+ DMA_BIDIRECTIONAL);
748+ skb_free_frag(vaddr);
749+ }
750+}
751+
721752 /* Perform a single release command to add buffers
722753 * to the specified buffer pool
723754 */
@@ -727,17 +758,17 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) · 3 unmodified lines
727758 u64 buf_array[DPAA2_ETH_BUFS_PER_CMD];
728759 void *buf;
729760 dma_addr_t addr;
730− int i;
761+ int i, err;
731762
732763 for (i = 0; i < DPAA2_ETH_BUFS_PER_CMD; i++) {
733764 /* Allocate buffer visible to WRIOP + skb shared info +
734765 * alignment padding
735766 */
736− buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
767+ buf = napi_alloc_frag(dpaa2_eth_buf_raw_size(priv));
737768 if (unlikely(!buf))
738769 goto err_alloc;
739770
740− buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
771+ buf = PTR_ALIGN(buf, priv->rx_buf_align);
741772
742773 addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
743774 DMA_FROM_DEVICE);
@@ -748,28 +779,33 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) · 4 unmodified lines
748779
749780 /* tracing point */
750781 trace_dpaa2_eth_buf_seed(priv->net_dev,
751− buf, DPAA2_ETH_BUF_RAW_SIZE,
782+ buf, dpaa2_eth_buf_raw_size(priv),
752783 addr, DPAA2_ETH_RX_BUF_SIZE,
753784 bpid);
754785 }
755786
756787 release_bufs:
757− /* In case the portal is busy, retry until successful.
758− * The buffer release function would only fail if the QBMan portal
759− * was busy, which implies portal contention (i.e. more CPUs than
760− * portals, i.e. GPPs w/o affine DPIOs). For all practical purposes,
761− * there is little we can realistically do, short of giving up -
762− * in which case we'd risk depleting the buffer pool and never again
763− * receiving the Rx interrupt which would kick-start the refill logic.
764− * So just keep retrying, at the risk of being moved to ksoftirqd.
765− */
766− while (dpaa2_io_service_release(NULL, bpid, buf_array, i))
788+ /* In case the portal is busy, retry until successful */
789+ while ((err = dpaa2_io_service_release(NULL, bpid,
790+ buf_array, i)) == -EBUSY)
767791 cpu_relax();
792+
793+ /* If release command failed, clean up and bail out;
794+ * not much else we can do about it
795+ */
796+ if (err) {
797+ free_bufs(priv, buf_array, i);
798+ return 0;
799+ }
800+
768801 return i;
769802
770803 err_map:
771804 skb_free_frag(buf);
772805 err_alloc:
806+ /* If we managed to allocate at least some buffers,
807+ * release them to hardware
808+ */
773809 if (i)
774810 goto release_bufs;
775811
@@ -811,10 +847,8 @@ static int seed_pool(struct dpaa2_eth_priv *priv, u16 bpid) · 35 unmodified lines
811847 */
812848 static void drain_bufs(struct dpaa2_eth_priv *priv, int count)
813849 {
814− struct device *dev = priv->net_dev->dev.parent;
815850 u64 buf_array[DPAA2_ETH_BUFS_PER_CMD];
816− void *vaddr;
817− int ret, i;
851+ int ret;
818852
819853 do {
820854 ret = dpaa2_io_service_acquire(NULL, priv->bpid,
@@ -823,15 +857,7 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) · 2 unmodified lines
823857 netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n");
824858 return;
825859 }
826− for (i = 0; i < ret; i++) {
827− /* Same logic as on regular Rx path */
828− vaddr = dpaa2_iova_to_virt(priv->iommu_domain,
829− buf_array[i]);
830− dma_unmap_single(dev, buf_array[i],
831− DPAA2_ETH_RX_BUF_SIZE,
832− DMA_FROM_DEVICE);
833− skb_free_frag(vaddr);
834− }
860+ free_bufs(priv, buf_array, ret);
835861 } while (ret);
836862 }
837863
@@ -927,13 +953,14 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget) · 89 unmodified lines
927953 break;
928954 }
929955
930− if (cleaned < budget) {
931− napi_complete_done(napi, cleaned);
956+ if (cleaned < budget && napi_complete_done(napi, cleaned)) {
932957 /* Re-enable data available notifications */
933958 do {
934959 err = dpaa2_io_service_rearm(NULL, &ch->nctx);
935960 cpu_relax();
936961 } while (err == -EBUSY);
962+ WARN_ONCE(err, "CDAN notifications rearm failed on core %d",
963+ ch->nctx.desired_cpu);
937964 }
938965
939966 ch->stats.frames += cleaned;
@@ -1415,34 +1442,32 @@ static struct fsl_mc_device *setup_dpcon(struct dpaa2_eth_priv *priv) · 475 unmodified lines
14151442 err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, &dpcon->mc_handle);
14161443 if (err) {
14171444 dev_err(dev, "dpcon_open() failed\n");
1418− goto err_open;
1445+ goto free;
14191446 }
14201447
14211448 err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
14221449 if (err) {
14231450 dev_err(dev, "dpcon_reset() failed\n");
1424− goto err_reset;
1451+ goto close;
14251452 }
14261453
14271454 err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, &attrs);
14281455 if (err) {
14291456 dev_err(dev, "dpcon_get_attributes() failed\n");
1430− goto err_get_attr;
1457+ goto close;
14311458 }
14321459
14331460 err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
14341461 if (err) {
14351462 dev_err(dev, "dpcon_enable() failed\n");
1436− goto err_enable;
1463+ goto close;
14371464 }
14381465
14391466 return dpcon;
14401467
1441−err_enable:
1442−err_get_attr:
1443−err_reset:
1468+close:
14441469 dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
1445−err_open:
1470+free:
14461471 fsl_mc_object_free(dpcon);
14471472
14481473 return NULL;
@@ -1749,66 +1774,32 @@ static void free_dpbp(struct dpaa2_eth_priv *priv) · 300 unmodified lines
17491774 fsl_mc_object_free(priv->dpbp_dev);
17501775 }
17511776
1752−/* Configure the DPNI object this interface is associated with */
1753−static int setup_dpni(struct fsl_mc_device *ls_dev)
1777+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
17541778 {
1755− struct device *dev = &ls_dev->dev;
1756− struct dpaa2_eth_priv *priv;
1757− struct net_device *net_dev;
1779+ struct device *dev = priv->net_dev->dev.parent;
17581780 struct dpni_buffer_layout buf_layout = {0};
17591781 int err;
17601782
1761− net_dev = dev_get_drvdata(dev);
1762− priv = netdev_priv(net_dev);
1763−
1764− /* get a handle for the DPNI object */
1765− err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token);
1766− if (err) {
1767− dev_err(dev, "dpni_open() failed\n");
1768− goto err_open;
1769− }
1770−
1771− ls_dev->mc_io = priv->mc_io;
1772− ls_dev->mc_handle = priv->mc_token;
1773−
1774− err = dpni_reset(priv->mc_io, 0, priv->mc_token);
1775− if (err) {
1776− dev_err(dev, "dpni_reset() failed\n");
1777− goto err_reset;
1778− }
1779−
1780− err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
1781− &priv->dpni_attrs);
1782− if (err) {
1783− dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
1784− goto err_get_attr;
1785− }
1783+ /* We need to check for WRIOP version 1.0.0, but depending on the MC
1784+ * version, this number is not always provided correctly on rev1.
1785+ * We need to check for both alternatives in this situation.
1786+ */
1787+ if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
1788+ priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
1789+ priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
1790+ else
1791+ priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
17861792
1787− /* Configure buffer layouts */
1788− /* rx buffer */
1789− buf_layout.pass_parser_result = true;
1793+ /* tx buffer */
17901794 buf_layout.pass_frame_status = true;
17911795 buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
1792− buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
1793− buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
1794− DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
1795− DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
1796− DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
1797− err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
1798− DPNI_QUEUE_RX, &buf_layout);
1799− if (err) {
1800− dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
1801− goto err_buf_layout;
1802− }
1803−
1804− /* tx buffer */
18051796 buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
18061797 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
18071798 err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
18081799 DPNI_QUEUE_TX, &buf_layout);
18091800 if (err) {
18101801 dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
1811− goto err_buf_layout;
1802+ return err;
18121803 }
18131804
18141805 /* tx-confirm buffer */
@@ -1817,7 +1808,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) · 2 unmodified lines
18171808 DPNI_QUEUE_TX_CONFIRM, &buf_layout);
18181809 if (err) {
18191810 dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
1820− goto err_buf_layout;
1811+ return err;
18211812 }
18221813
18231814 /* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1827,24 +1818,76 @@ static int setup_dpni(struct fsl_mc_device *ls_dev) · 3 unmodified lines
18271818 &priv->tx_data_offset);
18281819 if (err) {
18291820 dev_err(dev, "dpni_get_tx_data_offset() failed\n");
1830− goto err_data_offset;
1821+ return err;
18311822 }
18321823
18331824 if ((priv->tx_data_offset % 64) != 0)
18341825 dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
18351826 priv->tx_data_offset);
18361827
1837− /* Accommodate software annotation space (SWA) */
1838− priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
1828+ /* rx buffer */
1829+ buf_layout.pass_parser_result = true;
1830+ buf_layout.data_align = priv->rx_buf_align;
1831+ buf_layout.data_head_room = dpaa2_eth_rx_head_room(priv);
1832+ buf_layout.private_data_size = 0;
1833+ buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
1834+ DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
1835+ DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
1836+ DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM;
1837+ err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
1838+ DPNI_QUEUE_RX, &buf_layout);
1839+ if (err) {
1840+ dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
1841+ return err;
1842+ }
18391843
18401844 return 0;
1845+}
18411846
1842−err_data_offset:
1843−err_buf_layout:
1844−err_get_attr:
1845−err_reset:
1847+/* Configure the DPNI object this interface is associated with */
1848+static int setup_dpni(struct fsl_mc_device *ls_dev)
1849+{
1850+ struct device *dev = &ls_dev->dev;
1851+ struct dpaa2_eth_priv *priv;
1852+ struct net_device *net_dev;
1853+ int err;
1854+
1855+ net_dev = dev_get_drvdata(dev);
1856+ priv = netdev_priv(net_dev);
1857+
1858+ /* get a handle for the DPNI object */
1859+ err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, &priv->mc_token);
1860+ if (err) {
1861+ dev_err(dev, "dpni_open() failed\n");
1862+ return err;
1863+ }
1864+
1865+ ls_dev->mc_io = priv->mc_io;
1866+ ls_dev->mc_handle = priv->mc_token;
1867+
1868+ err = dpni_reset(priv->mc_io, 0, priv->mc_token);
1869+ if (err) {
1870+ dev_err(dev, "dpni_reset() failed\n");
1871+ goto close;
1872+ }
1873+
1874+ err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
1875+ &priv->dpni_attrs);
1876+ if (err) {
1877+ dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
1878+ goto close;
1879+ }
1880+
1881+ err = set_buffer_layout(priv);
1882+ if (err)
1883+ goto close;
1884+
1885+
1886+ return 0;
1887+
1888+close:
18461889 dpni_close(priv->mc_io, 0, priv->mc_token);
1847−err_open:
1890+
18481891 return err;
18491892 }
18501893
@@ -2085,7 +2128,7 @@ static int bind_dpni(struct dpaa2_eth_priv *priv) · 234 unmodified lines
20852128 */
20862129 err = dpaa2_eth_set_hash(net_dev, DPAA2_RXH_SUPPORTED);
20872130 if (err)
2088− netdev_err(net_dev, "Failed to configure hashing\n");
2131+ dev_err(dev, "Failed to configure hashing\n");
20892132
20902133 /* Configure handling of error frames */
20912134 err_cfg.errors = DPAA2_FAS_RX_ERR_MASK;
@@ -2230,6 +2273,7 @@ static int netdev_init(struct net_device *net_dev) · 138 unmodified lines
22302273 {
22312274 struct device *dev = net_dev->dev.parent;
22322275 struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
2276+ u16 rx_headroom, req_headroom;
22332277 u8 bcast_addr[ETH_ALEN];
22342278 u8 num_queues;
22352279 int err;
@@ -2251,7 +2295,20 @@ static int netdev_init(struct net_device *net_dev) · 15 unmodified lines
22512295 /* Reserve enough space to align buffer as per hardware requirement;
22522296 * NOTE: priv->tx_data_offset MUST be initialized at this point.
22532297 */
2254− net_dev->needed_headroom = DPAA2_ETH_NEEDED_HEADROOM(priv);
2298+ net_dev->needed_headroom = dpaa2_eth_needed_headroom(priv);
2299+
2300+ /* If headroom guaranteed by hardware in the Rx frame buffer is
2301+ * smaller than the Tx headroom required by the stack, issue a
2302+ * one time warning. This will most likely mean skbs forwarded to
2303+ * another DPAA2 network interface will get reallocated, with a
2304+ * significant performance impact.
2305+ */
2306+ req_headroom = LL_RESERVED_SPACE(net_dev) - ETH_HLEN;
2307+ rx_headroom = ALIGN(DPAA2_ETH_RX_HWA_SIZE +
2308+ dpaa2_eth_rx_head_room(priv), priv->rx_buf_align);
2309+ if (req_headroom > rx_headroom)
2310+ dev_info_once(dev, "Required headroom (%d) greater than available (%d)\n",
2311+ req_headroom, rx_headroom);
22552312
22562313 /* Set MTU limits */
22572314 net_dev->min_mtu = 68;
@@ -2303,7 +2360,7 @@ static irqreturn_t dpni_irq0_handler(int irq_num, void *arg) · 45 unmodified lines
23032360
23042361 static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
23052362 {
2306− u32 status = 0, clear = 0;
2363+ u32 status = ~0;
23072364 struct device *dev = (struct device *)arg;
23082365 struct fsl_mc_device *dpni_dev = to_fsl_mc_device(dev);
23092366 struct net_device *net_dev = dev_get_drvdata(dev);
@@ -2313,18 +2370,12 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) · 3 unmodified lines
23132370 DPNI_IRQ_INDEX, &status);
23142371 if (unlikely(err)) {
23152372 netdev_err(net_dev, "Can't get irq status (err %d)\n", err);
2316− clear = 0xffffffff;
2317− goto out;
2373+ return IRQ_HANDLED;
23182374 }
23192375
2320− if (status & DPNI_IRQ_EVENT_LINK_CHANGED) {
2321− clear |= DPNI_IRQ_EVENT_LINK_CHANGED;
2376+ if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
23222377 link_state_update(netdev_priv(net_dev));
2323− }
23242378
2325−out:
2326− dpni_clear_irq_status(dpni_dev->mc_io, 0, dpni_dev->mc_handle,
2327− DPNI_IRQ_INDEX, clear);
23282379 return IRQ_HANDLED;
23292380 }
23302381
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h+39−15
@@ -45,6 +45,8 @@ · 44 unmodified lines
4545
4646 #include "dpaa2-eth-trace.h"
4747
48+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
49+
4850 #define DPAA2_ETH_STORE_SIZE 16
4951
5052 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -80,23 +82,21 @@ · 29 unmodified lines
8082 */
8183 #define DPAA2_ETH_BUFS_PER_CMD 7
8284
83−/* Hardware requires alignment for ingress/egress buffer addresses
84− * and ingress buffer lengths.
85− */
86−#define DPAA2_ETH_RX_BUF_SIZE 2048
85+/* Hardware requires alignment for ingress/egress buffer addresses */
8786 #define DPAA2_ETH_TX_BUF_ALIGN 64
88−#define DPAA2_ETH_RX_BUF_ALIGN 256
89−#define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
90− ((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
9187
92−/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but we need to allocate ingress
93− * buffers large enough to allow building an skb around them and also account
94− * for alignment restrictions
88+#define DPAA2_ETH_RX_BUF_SIZE 2048
89+#define DPAA2_ETH_SKB_SIZE \
90+ (DPAA2_ETH_RX_BUF_SIZE + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
91+
92+/* Hardware annotation area in RX buffers */
93+#define DPAA2_ETH_RX_HWA_SIZE 64
94+
95+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
96+ * to 256B. For newer revisions, the requirement is only for 64B alignment
9597 */
96−#define DPAA2_ETH_BUF_RAW_SIZE \
97− (DPAA2_ETH_RX_BUF_SIZE + \
98− SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
99− DPAA2_ETH_RX_BUF_ALIGN)
98+#define DPAA2_ETH_RX_BUF_ALIGN_REV1 256
99+#define DPAA2_ETH_RX_BUF_ALIGN 64
100100
101101 /* We are accommodating a skb backpointer and some S/G info
102102 * in the frame's software annotation. The hardware
@@ -134,7 +134,7 @@ struct dpaa2_eth_swa { · 31 unmodified lines
134134 DPAA2_FD_CTRL_FAERR)
135135
136136 /* Annotation bits in FD CTRL */
137−#define DPAA2_FD_CTRL_ASAL 0x00020000 /* ASAL = 128 */
137+#define DPAA2_FD_CTRL_ASAL 0x00010000 /* ASAL = 64 */
138138 #define DPAA2_FD_CTRL_PTA 0x00800000
139139 #define DPAA2_FD_CTRL_PTV1 0x00400000
140140
@@ -318,6 +318,7 @@ struct dpaa2_eth_priv { · 177 unmodified lines
318318 struct iommu_domain *iommu_domain;
319319
320320 u16 tx_qdid;
321+ u16 rx_buf_align;
321322 struct fsl_mc_io *mc_io;
322323 /* Cores which have an affine DPIO/DPCON.
323324 * This is the cpu set on which Rx and Tx conf frames are processed
@@ -353,6 +354,29 @@ struct dpaa2_eth_priv { · 29 unmodified lines
353354 extern const struct ethtool_ops dpaa2_ethtool_ops;
354355 extern const char dpaa2_eth_drv_version[];
355356
357+/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but the skb built around
358+ * the buffer also needs space for its shared info struct, and we need
359+ * to allocate enough to accommodate hardware alignment restrictions
360+ */
361+static inline unsigned int dpaa2_eth_buf_raw_size(struct dpaa2_eth_priv *priv)
362+{
363+ return DPAA2_ETH_SKB_SIZE + priv->rx_buf_align;
364+}
365+
366+static inline
367+unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv)
368+{
369+ return priv->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN - HH_DATA_MOD;
370+}
371+
372+/* Extra headroom space requested to hardware, in order to make sure there's
373+ * no realloc'ing in forwarding scenarios
374+ */
375+static inline unsigned int dpaa2_eth_rx_head_room(struct dpaa2_eth_priv *priv)
376+{
377+ return dpaa2_eth_needed_headroom(priv) - DPAA2_ETH_RX_HWA_SIZE;
378+}
379+
356380 static int dpaa2_eth_queue_count(struct dpaa2_eth_priv *priv)
357381 {
358382 return priv->dpni_attrs.num_queues;
drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c+13−1
@@ -76,10 +76,22 @@ static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { · 75 unmodified lines
7676 static void dpaa2_eth_get_drvinfo(struct net_device *net_dev,
7777 struct ethtool_drvinfo *drvinfo)
7878 {
79+ struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
80+ u16 fw_major, fw_minor;
81+ int err;
82+
7983 strlcpy(drvinfo->driver, KBUILD_MODNAME, sizeof(drvinfo->driver));
8084 strlcpy(drvinfo->version, dpaa2_eth_drv_version,
8185 sizeof(drvinfo->version));
82− strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
86+
87+ err = dpni_get_api_version(priv->mc_io, 0, &fw_major, &fw_minor);
88+ if (!err)
89+ snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
90+ "%u.%u", fw_major, fw_minor);
91+ else
92+ strlcpy(drvinfo->fw_version, "N/A",
93+ sizeof(drvinfo->fw_version));
94+
8395 strlcpy(drvinfo->bus_info, dev_name(net_dev->dev.parent->parent),
8496 sizeof(drvinfo->bus_info));
8597 }
drivers/staging/fsl-dpaa2/ethernet/dpni-cmd.h+5−0
@@ -538,4 +538,9 @@ struct dpni_rsp_get_taildrop { · 537 unmodified lines
538538 __le32 threshold;
539539 };
540540
541+struct dpni_rsp_get_api_version {
542+ u16 major;
543+ u16 minor;
544+};
545+
541546 #endif /* _FSL_DPNI_CMD_H */
drivers/staging/fsl-dpaa2/ethernet/dpni.c+32−0
@@ -1594,3 +1594,35 @@ int dpni_get_taildrop(struct fsl_mc_io *mc_io, · 1593 unmodified lines
15941594
15951595 return 0;
15961596 }
1597+
1598+/**
1599+ * dpni_get_api_version() - Get Data Path Network Interface API version
1600+ * @mc_io: Pointer to MC portal's I/O object
1601+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1602+ * @major_ver: Major version of data path network interface API
1603+ * @minor_ver: Minor version of data path network interface API
1604+ *
1605+ * Return: '0' on Success; Error code otherwise.
1606+ */
1607+int dpni_get_api_version(struct fsl_mc_io *mc_io,
1608+ u32 cmd_flags,
1609+ u16 *major_ver,
1610+ u16 *minor_ver)
1611+{
1612+ struct dpni_rsp_get_api_version *rsp_params;
1613+ struct mc_command cmd = { 0 };
1614+ int err;
1615+
1616+ cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_API_VERSION,
1617+ cmd_flags, 0);
1618+
1619+ err = mc_send_command(mc_io, &cmd);
1620+ if (err)
1621+ return err;
1622+
1623+ rsp_params = (struct dpni_rsp_get_api_version *)cmd.params;
1624+ *major_ver = le16_to_cpu(rsp_params->major);
1625+ *minor_ver = le16_to_cpu(rsp_params->minor);
1626+
1627+ return 0;
1628+}
drivers/staging/fsl-dpaa2/ethernet/dpni.h+5−0
@@ -829,4 +829,9 @@ struct dpni_rule_cfg { · 828 unmodified lines
829829 u8 key_size;
830830 };
831831
832+int dpni_get_api_version(struct fsl_mc_io *mc_io,
833+ u32 cmd_flags,
834+ u16 *major_ver,
835+ u16 *minor_ver);
836+
832837 #endif /* __FSL_DPNI_H */
drivers/staging/fsl-mc/bus/dpio/dpio-service.c+2−2
@@ -76,7 +76,7 @@ static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d, · 75 unmodified lines
7676 if (d)
7777 return d;
7878
79− if (unlikely(cpu >= num_possible_cpus()))
79+ if (cpu != DPAA2_IO_ANY_CPU && cpu >= num_possible_cpus())
8080 return NULL;
8181
8282 /*
@@ -121,7 +121,7 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc) · 38 unmodified lines
121121 return NULL;
122122
123123 /* check if CPU is out of range (-1 means any cpu) */
124− if (desc->cpu >= num_possible_cpus()) {
124+ if (desc->cpu != DPAA2_IO_ANY_CPU && desc->cpu >= num_possible_cpus()) {
125125 kfree(obj);
126126 return NULL;
127127 }
drivers/staging/fsl-mc/bus/fsl-mc-msi.c+1−1
@@ -137,7 +137,7 @@ static void fsl_mc_msi_update_chip_ops(struct msi_domain_info *info) · 136 unmodified lines
137137 {
138138 struct irq_chip *chip = info->chip;
139139
140− if (WARN_ON((!chip)))
140+ if (WARN_ON(!chip))
141141 return;
142142
143143 /*
drivers/staging/fsl-mc/include/dpaa2-io.h+4−2
@@ -54,6 +54,8 @@ struct device; · 53 unmodified lines
5454 * for dequeue.
5555 */
5656
57+#define DPAA2_IO_ANY_CPU -1
58+
5759 /**
5860 * struct dpaa2_io_desc - The DPIO descriptor
5961 * @receives_notifications: Use notificaton mode. Non-zero if the DPIO
@@ -91,8 +93,8 @@ irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj); · 31 unmodified lines
9193 * @cb: The callback to be invoked when the notification arrives
9294 * @is_cdan: Zero for FQDAN, non-zero for CDAN
9395 * @id: FQID or channel ID, needed for rearm
94− * @desired_cpu: The cpu on which the notifications will show up. -1 means
95− * any CPU.
96+ * @desired_cpu: The cpu on which the notifications will show up. Use
97+ * DPAA2_IO_ANY_CPU if don't care
9698 * @dpio_id: The dpio index
9799 * @qman64: The 64-bit context value shows up in the FQDAN/CDAN.
98100 * @node: The list node
drivers/staging/fwserial/fwserial.c+4−12
@@ -217,13 +217,6 @@ static void fwtty_log_tx_error(struct fwtty_port *port, int rcode) · 216 unmodified lines
217217 }
218218 }
219219
220−static void fwtty_txn_constructor(void *this)
221−{
222− struct fwtty_transaction *txn = this;
223−
224− init_timer(&txn->fw_txn.split_timeout_timer);
225−}
226−
227220 static void fwtty_common_callback(struct fw_card *card, int rcode,
228221 void *payload, size_t len, void *cb_data)
229222 {
@@ -1806,9 +1799,9 @@ static void fwserial_release_port(struct fwtty_port *port, bool reset) · 1576 unmodified lines
18061799 (*port->fwcon_ops->notify)(FWCON_NOTIFY_DETACH, port->con_data);
18071800 }
18081801
1809−static void fwserial_plug_timeout(unsigned long data)
1802+static void fwserial_plug_timeout(struct timer_list *t)
18101803 {
1811− struct fwtty_peer *peer = (struct fwtty_peer *)data;
1804+ struct fwtty_peer *peer = from_timer(peer, t, timer);
18121805 struct fwtty_port *port;
18131806
18141807 spin_lock_bh(&peer->lock);
@@ -1860,7 +1853,6 @@ static int fwserial_connect_peer(struct fwtty_peer *peer) · 45 unmodified lines
18601853
18611854 fill_plug_req(pkt, peer->port);
18621855
1863− setup_timer(&peer->timer, fwserial_plug_timeout, (unsigned long)peer);
18641856 mod_timer(&peer->timer, jiffies + VIRT_CABLE_PLUG_TIMEOUT);
18651857 spin_unlock_bh(&peer->lock);
18661858
@@ -2098,7 +2090,7 @@ static int fwserial_add_peer(struct fw_serial *serial, struct fw_unit *unit) · 231 unmodified lines
20982090 spin_lock_init(&peer->lock);
20992091 peer->port = NULL;
21002092
2101− init_timer(&peer->timer);
2093+ timer_setup(&peer->timer, fwserial_plug_timeout, 0);
21022094 INIT_WORK(&peer->work, fwserial_peer_workfn);
21032095 INIT_DELAYED_WORK(&peer->connect, fwserial_auto_connect);
21042096
@@ -2863,7 +2855,7 @@ static int __init fwserial_init(void) · 758 unmodified lines
28632855
28642856 fwtty_txn_cache = kmem_cache_create("fwtty_txn_cache",
28652857 sizeof(struct fwtty_transaction),
2866− 0, 0, fwtty_txn_constructor);
2858+ 0, 0, NULL);
28672859 if (!fwtty_txn_cache) {
28682860 err = -ENOMEM;
28692861 goto unregister_loop;
drivers/staging/gdm724x/gdm_lte.c+12−7
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/icmp.h>
2727 #include <linux/icmpv6.h>
2828 #include <linux/uaccess.h>
29+#include <linux/errno.h>
2930 #include <net/ndisc.h>
3031
3132 #include "gdm_lte.h"
@@ -118,6 +119,10 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, u32 nic_type) · 86 unmodified lines
118119 void *mac_header_data;
119120 u32 mac_header_len;
120121
122+ /* Check for skb->len, discard if empty */
123+ if (skb_in->len == 0)
124+ return -ENODATA;
125+
121126 /* Format the mac header so that it can be put to skb */
122127 if (ntohs(((struct ethhdr *)skb_in->data)->h_proto) == ETH_P_8021Q) {
123128 memcpy(&vlan_eth, skb_in->data, sizeof(struct vlan_ethhdr));
@@ -241,13 +246,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) · 117 unmodified lines
241246 if (ntohs(((struct ethhdr *)skb_in->data)->h_proto) == ETH_P_8021Q) {
242247 memcpy(&vlan_eth, skb_in->data, sizeof(struct vlan_ethhdr));
243248 if (ntohs(vlan_eth.h_vlan_encapsulated_proto) != ETH_P_IPV6)
244− return -1;
249+ return -EPROTONOSUPPORT;
245250 mac_header_data = &vlan_eth;
246251 mac_header_len = VLAN_ETH_HLEN;
247252 } else {
248253 memcpy(&eth, skb_in->data, sizeof(struct ethhdr));
249254 if (ntohs(eth.h_proto) != ETH_P_IPV6)
250− return -1;
255+ return -EPROTONOSUPPORT;
251256 mac_header_data = &eth;
252257 mac_header_len = ETH_HLEN;
253258 }
@@ -255,13 +260,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) · 1 unmodified line
255260 /* Check if this is IPv6 ICMP packet */
256261 ipv6_in = (struct ipv6hdr *)(skb_in->data + mac_header_len);
257262 if (ipv6_in->version != 6 || ipv6_in->nexthdr != IPPROTO_ICMPV6)
258− return -1;
263+ return -EPROTONOSUPPORT;
259264
260265 /* Check if this is NDP packet */
261266 icmp6_in = (struct icmp6hdr *)(skb_in->data + mac_header_len +
262267 sizeof(struct ipv6hdr));
263268 if (icmp6_in->icmp6_type == NDISC_ROUTER_SOLICITATION) { /* Check RS */
264− return -1;
269+ return -EPROTONOSUPPORT;
265270 } else if (icmp6_in->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
266271 /* Check NS */
267272 u8 icmp_na[sizeof(struct icmp6hdr) +
@@ -305,7 +310,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) · 37 unmodified lines
305310 icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
306311 (u16 *)icmp_na, sizeof(icmp_na));
307312 } else {
308− return -1;
313+ return -EINVAL;
309314 }
310315
311316 /* Fill the destination mac with source mac of the received packet */
@@ -412,7 +417,7 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) · 100 unmodified lines
412417 nic_type = gdm_lte_tx_nic_type(dev, skb);
413418 if (nic_type == 0) {
414419 netdev_err(dev, "tx - invalid nic_type\n");
415− return -1;
420+ return -EMEDIUMTYPE;
416421 }
417422
418423 if (nic_type & NIC_TYPE_ARP) {
@@ -539,7 +544,7 @@ int gdm_lte_event_init(void) · 120 unmodified lines
539544 }
540545
541546 pr_err("event init failed\n");
542− return -1;
547+ return -ENODATA;
543548 }
544549
545550 void gdm_lte_event_exit(void)
drivers/staging/greybus/Documentation/firmware/authenticate.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * Sample code to test CAP protocol
34 *
drivers/staging/greybus/Documentation/firmware/firmware.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * Sample code to test firmware-management protocol
34 *
drivers/staging/greybus/arche-apb-ctrl.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Arche Platform driver to control APB.
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/clk.h>
drivers/staging/greybus/arche-platform.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Arche Platform driver to enable Unipro link.
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/clk.h>
drivers/staging/greybus/arche_platform.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Arche Platform driver to enable Unipro link.
34 *
45 * Copyright 2015-2016 Google Inc.
56 * Copyright 2015-2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __ARCHE_PLATFORM_H
drivers/staging/greybus/arpc.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * This file is provided under a dual BSD/GPLv2 license. When using or
34 * redistributing this file, you may do so under either license.
drivers/staging/greybus/audio_apbridgea.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Audio Device Class Protocol helpers
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include "greybus.h"
drivers/staging/greybus/audio_apbridgea.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: BSD-3-Clause
12 /**
23 * Copyright (c) 2015-2016 Google Inc.
34 * All rights reserved.
drivers/staging/greybus/audio_codec.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * APBridge ALSA SoC dummy codec driver
34 * Copyright 2016 Google Inc.
45 * Copyright 2016 Linaro Ltd.
5− *
6− * Released under the GPLv2 only.
76 */
87 #include <linux/kernel.h>
98 #include <linux/module.h>
drivers/staging/greybus/audio_codec.h+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus audio driver
34 * Copyright 2015 Google Inc.
45 * Copyright 2015 Linaro Ltd.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #ifndef __LINUX_GBAUDIO_CODEC_H
drivers/staging/greybus/audio_gb.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Audio Device Class Protocol helpers
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include "greybus.h"
drivers/staging/greybus/audio_manager.c+2−3
@@ -1,16 +1,15 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include <linux/string.h>
109 #include <linux/sysfs.h>
1110 #include <linux/module.h>
1211 #include <linux/init.h>
13−#include <linux/rwlock.h>
12+#include <linux/spinlock.h>
1413 #include <linux/idr.h>
1514
1615 #include "audio_manager.h"
drivers/staging/greybus/audio_manager.h+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #ifndef _GB_AUDIO_MANAGER_H_
drivers/staging/greybus/audio_manager_module.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include <linux/slab.h>
drivers/staging/greybus/audio_manager_private.h+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #ifndef _GB_AUDIO_MANAGER_PRIVATE_H_
drivers/staging/greybus/audio_manager_sysfs.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2015-2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include <linux/string.h>
drivers/staging/greybus/audio_module.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus audio driver
34 * Copyright 2015 Google Inc.
45 * Copyright 2015 Linaro Ltd.
5− *
6− * Released under the GPLv2 only.
76 */
87 #include <linux/kernel.h>
98 #include <linux/module.h>
drivers/staging/greybus/audio_topology.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus audio driver
34 * Copyright 2015-2016 Google Inc.
45 * Copyright 2015-2016 Linaro Ltd.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include "audio_codec.h"
drivers/staging/greybus/authentication.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Component Authentication Protocol (CAP) Driver.
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include "greybus.h"
drivers/staging/greybus/bootrom.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * BOOTROM Greybus driver.
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/firmware.h>
drivers/staging/greybus/bundle.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus bundles
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include "greybus.h"
drivers/staging/greybus/bundle.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus bundles
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __BUNDLE_H
drivers/staging/greybus/camera.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Camera protocol driver.
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/debugfs.h>
drivers/staging/greybus/connection.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus connections
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/workqueue.h>
drivers/staging/greybus/connection.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus connections
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __CONNECTION_H
drivers/staging/greybus/control.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus CPort control protocol.
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/control.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus CPort control protocol
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __CONTROL_H
drivers/staging/greybus/core.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus "Core"
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
drivers/staging/greybus/debugfs.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus debugfs code
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/debugfs.h>
drivers/staging/greybus/es2.c+2−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus "AP" USB driver for "ES2" controller chips
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98 #include <linux/kthread.h>
109 #include <linux/sizes.h>
@@ -761,6 +760,7 @@ static int check_urb_status(struct urb *urb) · 750 unmodified lines
761760 case -EOVERFLOW:
762761 dev_err(dev, "%s: overflow actual length is %d\n",
763762 __func__, urb->actual_length);
763+ /* fall through */
764764 case -ECONNRESET:
765765 case -ENOENT:
766766 case -ESHUTDOWN:
drivers/staging/greybus/firmware.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Firmware Management Header
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __FIRMWARE_H
drivers/staging/greybus/fw-core.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Firmware Core Bundle Driver.
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
109
drivers/staging/greybus/fw-download.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Firmware Download Protocol Driver.
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/firmware.h>
drivers/staging/greybus/fw-management.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Firmware Management Protocol Driver.
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/cdev.h>
drivers/staging/greybus/gb-camera.h+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Camera protocol driver.
34 *
45 * Copyright 2015 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87 #ifndef __GB_CAMERA_H
98 #define __GB_CAMERA_H
drivers/staging/greybus/gbphy.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Bridged-Phy Bus driver
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
drivers/staging/greybus/gbphy.h+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Bridged-Phy Bus driver
34 *
45 * Copyright 2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #ifndef __GBPHY_H
drivers/staging/greybus/gpio.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPIO Greybus driver.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/greybus.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus driver and device API
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __LINUX_GREYBUS_H
drivers/staging/greybus/greybus_authentication.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * Greybus Component Authentication User Header
34 *
drivers/staging/greybus/greybus_firmware.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * Greybus Firmware Management User Header
34 *
drivers/staging/greybus/greybus_manifest.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus manifest definition
34 *
drivers/staging/greybus/greybus_protocols.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
12 /*
23 * This file is provided under a dual BSD/GPLv2 license. When using or
34 * redistributing this file, you may do so under either license.
drivers/staging/greybus/greybus_trace.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus driver and device API
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98 #undef TRACE_SYSTEM
109 #define TRACE_SYSTEM greybus
drivers/staging/greybus/hd.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Host Device
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/hd.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Host Device
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __HD_H
drivers/staging/greybus/hid.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * HID class driver for the Greybus.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/bitops.h>
drivers/staging/greybus/i2c.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * I2C bridge driver for the Greybus "generic" I2C module.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/interface.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus interface code
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/delay.h>
drivers/staging/greybus/interface.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Interface Block code
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __INTERFACE_H
drivers/staging/greybus/light.c+4−7
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Lights protocol driver.
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
@@ -925,6 +924,8 @@ static void __gb_lights_led_unregister(struct gb_channel *channel) · 914 unmodified lines
925924 return;
926925
927926 led_classdev_unregister(cdev);
927+ kfree(cdev->name);
928+ cdev->name = NULL;
928929 channel->led = NULL;
929930 }
930931
@@ -998,11 +999,7 @@ static int gb_lights_channel_config(struct gb_light *light, · 67 unmodified lines
998999
9991000 light->has_flash = true;
10001001
1001− ret = gb_lights_channel_flash_config(channel);
1002− if (ret < 0)
1003− return ret;
1004−
1005− return ret;
1002+ return gb_lights_channel_flash_config(channel);
10061003 }
10071004
10081005 static int gb_lights_light_config(struct gb_lights *glights, u8 id)
drivers/staging/greybus/log.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus driver for the log protocol
34 *
45 * Copyright 2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87 #include <linux/kernel.h>
98 #include <linux/module.h>
drivers/staging/greybus/loopback.c+52−190
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Loopback bridge driver for the Greybus loopback module.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -58,12 +57,7 @@ static struct gb_loopback_device gb_dev; · 47 unmodified lines
5857 struct gb_loopback_async_operation {
5958 struct gb_loopback *gb;
6059 struct gb_operation *operation;
61− struct timeval ts;
62− struct timer_list timer;
63− struct list_head entry;
64− struct work_struct work;
65− struct kref kref;
66− bool pending;
60+ ktime_t ts;
6761 int (*completion)(struct gb_loopback_async_operation *op_async);
6862 };
6963
@@ -72,7 +66,6 @@ struct gb_loopback { · 2 unmodified lines
7266
7367 struct dentry *file;
7468 struct kfifo kfifo_lat;
75− struct kfifo kfifo_ts;
7669 struct mutex mutex;
7770 struct task_struct *task;
7871 struct list_head entry;
@@ -82,7 +75,7 @@ struct gb_loopback { · 3 unmodified lines
8275 atomic_t outstanding_operations;
8376
8477 /* Per connection stats */
85− struct timeval ts;
78+ ktime_t ts;
8679 struct gb_loopback_stats latency;
8780 struct gb_loopback_stats throughput;
8881 struct gb_loopback_stats requests_per_second;
@@ -262,7 +255,6 @@ static void gb_loopback_check_attr(struct gb_loopback *gb) · 173 unmodified lines
262255 gb->iteration_max, kfifo_depth);
263256 }
264257 kfifo_reset_out(&gb->kfifo_lat);
265− kfifo_reset_out(&gb->kfifo_ts);
266258
267259 switch (gb->type) {
268260 case GB_LOOPBACK_TYPE_PING:
@@ -377,21 +369,9 @@ static u64 __gb_loopback_calc_latency(u64 t1, u64 t2) · 108 unmodified lines
377369 return NSEC_PER_DAY - t2 + t1;
378370 }
379371
380−static u64 gb_loopback_calc_latency(struct timeval *ts, struct timeval *te)
381−{
382− u64 t1, t2;
383−
384− t1 = timeval_to_ns(ts);
385− t2 = timeval_to_ns(te);
386−
387− return __gb_loopback_calc_latency(t1, t2);
388−}
389−
390−static void gb_loopback_push_latency_ts(struct gb_loopback *gb,
391− struct timeval *ts, struct timeval *te)
372+static u64 gb_loopback_calc_latency(ktime_t ts, ktime_t te)
392373 {
393− kfifo_in(&gb->kfifo_ts, (unsigned char *)ts, sizeof(*ts));
394− kfifo_in(&gb->kfifo_ts, (unsigned char *)te, sizeof(*te));
374+ return __gb_loopback_calc_latency(ktime_to_ns(ts), ktime_to_ns(te));
395375 }
396376
397377 static int gb_loopback_operation_sync(struct gb_loopback *gb, int type,
@@ -399,10 +379,10 @@ static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, · 1 unmodified line
399379 void *response, int response_size)
400380 {
401381 struct gb_operation *operation;
402− struct timeval ts, te;
382+ ktime_t ts, te;
403383 int ret;
404384
405− do_gettimeofday(&ts);
385+ ts = ktime_get();
406386 operation = gb_operation_create(gb->connection, type, request_size,
407387 response_size, GFP_KERNEL);
408388 if (!operation)
@@ -430,11 +410,10 @@ static int gb_loopback_operation_sync(struct gb_loopback *gb, int type, · 21 unmodified lines
430410 }
431411 }
432412
433− do_gettimeofday(&te);
413+ te = ktime_get();
434414
435415 /* Calculate the total time the message took */
436− gb_loopback_push_latency_ts(gb, &ts, &te);
437− gb->elapsed_nsecs = gb_loopback_calc_latency(&ts, &te);
416+ gb->elapsed_nsecs = gb_loopback_calc_latency(ts, te);
438417
439418 out_put_operation:
440419 gb_operation_put(operation);
@@ -442,56 +421,6 @@ out_put_operation: · 1 unmodified line
442421 return ret;
443422 }
444423
445−static void __gb_loopback_async_operation_destroy(struct kref *kref)
446−{
447− struct gb_loopback_async_operation *op_async;
448−
449− op_async = container_of(kref, struct gb_loopback_async_operation, kref);
450−
451− list_del(&op_async->entry);
452− if (op_async->operation)
453− gb_operation_put(op_async->operation);
454− atomic_dec(&op_async->gb->outstanding_operations);
455− wake_up(&op_async->gb->wq_completion);
456− kfree(op_async);
457−}
458−
459−static void gb_loopback_async_operation_get(struct gb_loopback_async_operation
460− *op_async)
461−{
462− kref_get(&op_async->kref);
463−}
464−
465−static void gb_loopback_async_operation_put(struct gb_loopback_async_operation
466− *op_async)
467−{
468− unsigned long flags;
469−
470− spin_lock_irqsave(&gb_dev.lock, flags);
471− kref_put(&op_async->kref, __gb_loopback_async_operation_destroy);
472− spin_unlock_irqrestore(&gb_dev.lock, flags);
473−}
474−
475−static struct gb_loopback_async_operation *
476− gb_loopback_operation_find(u16 id)
477−{
478− struct gb_loopback_async_operation *op_async;
479− bool found = false;
480− unsigned long flags;
481−
482− spin_lock_irqsave(&gb_dev.lock, flags);
483− list_for_each_entry(op_async, &gb_dev.list_op_async, entry) {
484− if (op_async->operation->id == id) {
485− gb_loopback_async_operation_get(op_async);
486− found = true;
487− break;
488− }
489− }
490− spin_unlock_irqrestore(&gb_dev.lock, flags);
491−
492− return found ? op_async : NULL;
493−}
494−
495424 static void gb_loopback_async_wait_all(struct gb_loopback *gb)
496425 {
497426 wait_event(gb->wq_completion,
@@ -502,87 +431,42 @@ static void gb_loopback_async_operation_callback(struct gb_operation *operation) · 4 unmodified lines
502431 {
503432 struct gb_loopback_async_operation *op_async;
504433 struct gb_loopback *gb;
505− struct timeval te;
506− bool err = false;
507−
508− do_gettimeofday(&te);
509− op_async = gb_loopback_operation_find(operation->id);
510− if (!op_async)
511− return;
434+ ktime_t te;
435+ int result;
512436
437+ te = ktime_get();
438+ result = gb_operation_result(operation);
439+ op_async = gb_operation_get_data(operation);
513440 gb = op_async->gb;
441+
514442 mutex_lock(&gb->mutex);
515443
516− if (!op_async->pending || gb_operation_result(operation)) {
517− err = true;
444+ if (!result && op_async->completion)
445+ result = op_async->completion(op_async);
446+
447+ if (!result) {
448+ gb->elapsed_nsecs = gb_loopback_calc_latency(op_async->ts, te);
518449 } else {
519− if (op_async->completion)
520− if (op_async->completion(op_async))
521− err = true;
450+ gb->error++;
451+ if (result == -ETIMEDOUT)
452+ gb->requests_timedout++;
522453 }
523454
524− if (!err) {
525− gb_loopback_push_latency_ts(gb, &op_async->ts, &te);
526− gb->elapsed_nsecs = gb_loopback_calc_latency(&op_async->ts,
527− &te);
528− }
455+ gb->iteration_count++;
456+ gb_loopback_calculate_stats(gb, result);
529457
530− if (op_async->pending) {
531− if (err)
532− gb->error++;
533− gb->iteration_count++;
534− op_async->pending = false;
535− del_timer_sync(&op_async->timer);
536− gb_loopback_async_operation_put(op_async);
537− gb_loopback_calculate_stats(gb, err);
538− }
539458 mutex_unlock(&gb->mutex);
540459
541460 dev_dbg(&gb->connection->bundle->dev, "complete operation %d\n",
542461 operation->id);
543462
544− gb_loopback_async_operation_put(op_async);
545−}
546−
547−static void gb_loopback_async_operation_work(struct work_struct *work)
548−{
549− struct gb_loopback *gb;
550− struct gb_operation *operation;
551− struct gb_loopback_async_operation *op_async;
552−
553− op_async = container_of(work, struct gb_loopback_async_operation, work);
554− gb = op_async->gb;
555− operation = op_async->operation;
556−
557− mutex_lock(&gb->mutex);
558− if (op_async->pending) {
559− gb->requests_timedout++;
560− gb->error++;
561− gb->iteration_count++;
562− op_async->pending = false;
563− gb_loopback_async_operation_put(op_async);
564− gb_loopback_calculate_stats(gb, true);
565− }
566− mutex_unlock(&gb->mutex);
567−
568− dev_dbg(&gb->connection->bundle->dev, "timeout operation %d\n",
569− operation->id);
570−
571− gb_operation_cancel(operation, -ETIMEDOUT);
572− gb_loopback_async_operation_put(op_async);
573−}
574−
575−static void gb_loopback_async_operation_timeout(unsigned long data)
576−{
577− struct gb_loopback_async_operation *op_async;
578− u16 id = data;
463+ /* Wake up waiters */
464+ atomic_dec(&op_async->gb->outstanding_operations);
465+ wake_up(&gb->wq_completion);
579466
580− op_async = gb_loopback_operation_find(id);
581− if (!op_async) {
582− pr_err("operation %d not found - time out ?\n", id);
583− return;
584− }
585− schedule_work(&op_async->work);
467+ /* Release resources */
468+ gb_operation_put(operation);
469+ kfree(op_async);
586470 }
587471
588472 static int gb_loopback_async_operation(struct gb_loopback *gb, int type,
@@ -593,15 +477,11 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, · 4 unmodified lines
593477 struct gb_loopback_async_operation *op_async;
594478 struct gb_operation *operation;
595479 int ret;
596− unsigned long flags;
597480
598481 op_async = kzalloc(sizeof(*op_async), GFP_KERNEL);
599482 if (!op_async)
600483 return -ENOMEM;
601484
602− INIT_WORK(&op_async->work, gb_loopback_async_operation_work);
603− kref_init(&op_async->kref);
604−
605485 operation = gb_operation_create(gb->connection, type, request_size,
606486 response_size, GFP_KERNEL);
607487 if (!operation) {
@@ -612,35 +492,24 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, · 4 unmodified lines
612492 if (request_size)
613493 memcpy(operation->request->payload, request, request_size);
614494
495+ gb_operation_set_data(operation, op_async);
496+
615497 op_async->gb = gb;
616498 op_async->operation = operation;
617499 op_async->completion = completion;
618500
619− spin_lock_irqsave(&gb_dev.lock, flags);
620− list_add_tail(&op_async->entry, &gb_dev.list_op_async);
621− spin_unlock_irqrestore(&gb_dev.lock, flags);
501+ op_async->ts = ktime_get();
622502
623− do_gettimeofday(&op_async->ts);
624− op_async->pending = true;
625503 atomic_inc(&gb->outstanding_operations);
626− mutex_lock(&gb->mutex);
627504 ret = gb_operation_request_send(operation,
628505 gb_loopback_async_operation_callback,
629− 0,
506+ jiffies_to_msecs(gb->jiffy_timeout),
630507 GFP_KERNEL);
631− if (ret)
632− goto error;
633−
634− setup_timer(&op_async->timer, gb_loopback_async_operation_timeout,
635− (unsigned long)operation->id);
636− op_async->timer.expires = jiffies + gb->jiffy_timeout;
637− add_timer(&op_async->timer);
638−
639− goto done;
640−error:
641− gb_loopback_async_operation_put(op_async);
642−done:
643− mutex_unlock(&gb->mutex);
508+ if (ret) {
509+ atomic_dec(&gb->outstanding_operations);
510+ gb_operation_put(operation);
511+ kfree(op_async);
512+ }
644513 return ret;
645514 }
646515
@@ -854,7 +723,7 @@ static void gb_loopback_reset_stats(struct gb_loopback *gb) · 207 unmodified lines
854723 /* Should be initialized at least once per transaction set */
855724 gb->apbridge_latency_ts = 0;
856725 gb->gbphy_latency_ts = 0;
857− memset(&gb->ts, 0, sizeof(struct timeval));
726+ gb->ts = ktime_set(0, 0);
858727 }
859728
860729 static void gb_loopback_update_stats(struct gb_loopback_stats *stats, u32 val)
@@ -937,15 +806,15 @@ static void gb_loopback_calculate_stats(struct gb_loopback *gb, bool error) · 76 unmodified lines
937806 {
938807 u64 nlat;
939808 u32 lat;
940− struct timeval te;
809+ ktime_t te;
941810
942811 if (!error) {
943812 gb->requests_completed++;
944813 gb_loopback_calculate_latency_stats(gb);
945814 }
946815
947− do_gettimeofday(&te);
948− nlat = gb_loopback_calc_latency(&gb->ts, &te);
816+ te = ktime_get();
817+ nlat = gb_loopback_calc_latency(gb->ts, te);
949818 if (nlat >= NSEC_PER_SEC || gb->iteration_count == gb->iteration_max) {
950819 lat = gb_loopback_nsec_to_usec_latency(nlat);
951820
@@ -1029,9 +898,8 @@ static int gb_loopback_fn(void *data) · 77 unmodified lines
1029898 size = gb->size;
1030899 us_wait = gb->us_wait;
1031900 type = gb->type;
1032− if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0)
1033− do_gettimeofday(&gb->ts);
1034− mutex_unlock(&gb->mutex);
901+ if (ktime_to_ns(gb->ts) == 0)
902+ gb->ts = ktime_get();
1035903
1036904 /* Else operations to perform */
1037905 if (gb->async) {
@@ -1042,8 +910,10 @@ static int gb_loopback_fn(void *data) · 4 unmodified lines
1042910 else if (type == GB_LOOPBACK_TYPE_SINK)
1043911 error = gb_loopback_async_sink(gb, size);
1044912
1045− if (error)
913+ if (error) {
1046914 gb->error++;
915+ gb->iteration_count++;
916+ }
1047917 } else {
1048918 /* We are effectively single threaded here */
1049919 if (type == GB_LOOPBACK_TYPE_PING)
@@ -1059,6 +929,7 @@ static int gb_loopback_fn(void *data) · 9 unmodified lines
1059929 gb_loopback_calculate_stats(gb, !!error);
1060930 }
1061931 gb->send_count++;
932+ mutex_unlock(&gb->mutex);
1062933
1063934 if (us_wait) {
1064935 if (us_wait < 20000)
@@ -1241,18 +1112,12 @@ static int gb_loopback_probe(struct gb_bundle *bundle, · 176 unmodified lines
12411112 retval = -ENOMEM;
12421113 goto out_conn;
12431114 }
1244− if (kfifo_alloc(&gb->kfifo_ts, kfifo_depth * sizeof(struct timeval) * 2,
1245− GFP_KERNEL)) {
1246− retval = -ENOMEM;
1247− goto out_kfifo0;
1248− }
1249−
12501115 /* Fork worker thread */
12511116 mutex_init(&gb->mutex);
12521117 gb->task = kthread_run(gb_loopback_fn, gb, "gb_loopback");
12531118 if (IS_ERR(gb->task)) {
12541119 retval = PTR_ERR(gb->task);
1255− goto out_kfifo1;
1120+ goto out_kfifo;
12561121 }
12571122
12581123 spin_lock_irqsave(&gb_dev.lock, flags);
@@ -1266,9 +1131,7 @@ static int gb_loopback_probe(struct gb_bundle *bundle, · 7 unmodified lines
12661131
12671132 return 0;
12681133
1269−out_kfifo1:
1270− kfifo_free(&gb->kfifo_ts);
1271−out_kfifo0:
1134+out_kfifo:
12721135 kfifo_free(&gb->kfifo_lat);
12731136 out_conn:
12741137 device_unregister(dev);
@@ -1302,7 +1165,6 @@ static void gb_loopback_disconnect(struct gb_bundle *bundle) · 27 unmodified lines
13021165 kthread_stop(gb->task);
13031166
13041167 kfifo_free(&gb->kfifo_lat);
1305− kfifo_free(&gb->kfifo_ts);
13061168 gb_connection_latency_tag_disable(gb->connection);
13071169 debugfs_remove(gb->file);
13081170
drivers/staging/greybus/manifest.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus manifest parsing
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include "greybus.h"
drivers/staging/greybus/manifest.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus manifest parsing
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __MANIFEST_H
drivers/staging/greybus/module.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Module code
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include "greybus.h"
drivers/staging/greybus/module.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Module code
34 *
45 * Copyright 2016 Google Inc.
56 * Copyright 2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __MODULE_H
drivers/staging/greybus/operation.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/operation.h+14−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus operations
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __OPERATION_H
@@ -105,6 +104,8 @@ struct gb_operation { · 94 unmodified lines
105104
106105 int active;
107106 struct list_head links; /* connection->operations */
107+
108+ void *private;
108109 };
109110
110111 static inline bool
@@ -206,6 +207,17 @@ static inline int gb_operation_unidirectional(struct gb_connection *connection, · 95 unmodified lines
206207 request, request_size, GB_OPERATION_TIMEOUT_DEFAULT);
207208 }
208209
210+static inline void *gb_operation_get_data(struct gb_operation *operation)
211+{
212+ return operation->private;
213+}
214+
215+static inline void gb_operation_set_data(struct gb_operation *operation,
216+ void *data)
217+{
218+ operation->private = data;
219+}
220+
209221 int gb_operation_init(void);
210222 void gb_operation_exit(void);
211223
drivers/staging/greybus/power_supply.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Power Supply driver for a Greybus module.
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/pwm.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * PWM Greybus driver.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/raw.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus driver for the Raw protocol
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98 #include <linux/kernel.h>
109 #include <linux/module.h>
drivers/staging/greybus/sdio.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * SD/MMC Greybus driver.
34 *
45 * Copyright 2014-2015 Google Inc.
56 * Copyright 2014-2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/greybus/spi.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * SPI bridge PHY driver.
34 *
45 * Copyright 2014-2016 Google Inc.
56 * Copyright 2014-2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/module.h>
drivers/staging/greybus/spilib.c+6−5
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus SPI library
34 *
45 * Copyright 2014-2016 Google Inc.
56 * Copyright 2014-2016 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/bitops.h>
@@ -544,11 +543,14 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev, · 533 unmodified lines
544543
545544 return 0;
546545
547−exit_spi_unregister:
548− spi_unregister_master(master);
549546 exit_spi_put:
550547 spi_master_put(master);
551548
549+ return ret;
550+
551+exit_spi_unregister:
552+ spi_unregister_master(master);
553+
552554 return ret;
553555 }
554556 EXPORT_SYMBOL_GPL(gb_spilib_master_init);
@@ -558,7 +560,6 @@ void gb_spilib_master_exit(struct gb_connection *connection) · 3 unmodified lines
558560 struct spi_master *master = gb_connection_get_data(connection);
559561
560562 spi_unregister_master(master);
561− spi_master_put(master);
562563 }
563564 EXPORT_SYMBOL_GPL(gb_spilib_master_exit);
564565
drivers/staging/greybus/spilib.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus SPI library header
34 *
drivers/staging/greybus/svc.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * SVC Greybus driver.
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/debugfs.h>
drivers/staging/greybus/svc.h+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus SVC code
34 *
45 * Copyright 2015 Google Inc.
56 * Copyright 2015 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #ifndef __SVC_H
drivers/staging/greybus/svc_watchdog.c+1−2
@@ -1,9 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * SVC Greybus "watchdog" driver.
34 *
45 * Copyright 2016 Google Inc.
5− *
6− * Released under the GPLv2 only.
76 */
87
98 #include <linux/delay.h>
drivers/staging/greybus/tools/lbtest+1−0
@@ -1,4 +1,5 @@
11 #!/usr/bin/env python
2+# SPDX-License-Identifier: BSD-3-Clause
23
34 # Copyright (c) 2015 Google, Inc.
45 # Copyright (c) 2015 Linaro, Ltd.
drivers/staging/greybus/tools/loopback_test.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: BSD-3-Clause
12 /*
23 * Loopback test application
34 *
drivers/staging/greybus/uart.c+1−2
@@ -1,11 +1,10 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * UART driver for the Greybus "generic" UART module.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
67 *
7− * Released under the GPLv2 only.
8− *
98 * Heavily based on drivers/usb/class/cdc-acm.c and
109 * drivers/usb/serial/usb-serial.c.
1110 */
drivers/staging/greybus/usb.c+1−3
@@ -1,11 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * USB host driver for the Greybus "generic" USB module.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
8− *
97 */
108 #include <linux/kernel.h>
119 #include <linux/module.h>
drivers/staging/greybus/vibrator.c+1−2
@@ -1,10 +1,9 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Greybus Vibrator protocol driver.
34 *
45 * Copyright 2014 Google Inc.
56 * Copyright 2014 Linaro Ltd.
6− *
7− * Released under the GPLv2 only.
87 */
98
109 #include <linux/kernel.h>
drivers/staging/gs_fpgaboot/gs_fpgaboot.c+1−1
@@ -106,7 +106,7 @@ static int readmagic_bitstream(u8 *bitdata, int *offset) · 105 unmodified lines
106106 read_bitstream(bitdata, buf, offset, 13);
107107 r = memcmp(buf, bits_magic, 13);
108108 if (r) {
109− pr_err("error: corrupted header");
109+ pr_err("error: corrupted header\n");
110110 return -EINVAL;
111111 }
112112 pr_info("bitstream file magic number Ok\n");
drivers/staging/iio/Documentation/device.txt+0−3
@@ -26,9 +26,6 @@ Then fill in the following: · 25 unmodified lines
2626 pointer to a structure with elements that tend to be fixed for
2727 large sets of different parts supported by a given driver.
2828 This contains:
29− * info->driver_module:
30− Set to THIS_MODULE. Used to ensure correct ownership
31− of various resources allocate by the core.
3229 * info->event_attrs:
3330 Attributes used to enable / disable hardware events.
3431 * info->attrs:
drivers/staging/iio/Documentation/trigger.txt+0−4
@@ -10,10 +10,6 @@ struct iio_trig *trig = iio_trigger_alloc("<trigger format string>", ...); · 9 unmodified lines
1010 allocates a trigger structure. The key elements to then fill in within
1111 a driver are:
1212
13−trig->owner
14− Typically set to THIS_MODULE. Used to ensure correct
15− ownership of core allocated resources.
16−
1713 trig->set_trigger_state:
1814 Function that enables / disables the underlying source of the trigger.
1915
drivers/staging/iio/accel/adis16201.c+0−1
@@ -284,7 +284,6 @@ static const struct iio_info adis16201_info = { · 283 unmodified lines
284284 .read_raw = adis16201_read_raw,
285285 .write_raw = adis16201_write_raw,
286286 .update_scan_mode = adis_update_scan_mode,
287− .driver_module = THIS_MODULE,
288287 };
289288
290289 static const char * const adis16201_status_error_msgs[] = {
drivers/staging/iio/accel/adis16203.c+0−1
@@ -232,7 +232,6 @@ static const struct iio_info adis16203_info = { · 231 unmodified lines
232232 .read_raw = adis16203_read_raw,
233233 .write_raw = adis16203_write_raw,
234234 .update_scan_mode = adis_update_scan_mode,
235− .driver_module = THIS_MODULE,
236235 };
237236
238237 static const char * const adis16203_status_error_msgs[] = {
drivers/staging/iio/accel/adis16209.c+0−1
@@ -285,7 +285,6 @@ static const struct iio_info adis16209_info = { · 284 unmodified lines
285285 .read_raw = adis16209_read_raw,
286286 .write_raw = adis16209_write_raw,
287287 .update_scan_mode = adis_update_scan_mode,
288− .driver_module = THIS_MODULE,
289288 };
290289
291290 static const char * const adis16209_status_error_msgs[] = {
drivers/staging/iio/accel/adis16240.c+0−1
@@ -361,7 +361,6 @@ static const struct iio_info adis16240_info = { · 360 unmodified lines
361361 .read_raw = adis16240_read_raw,
362362 .write_raw = adis16240_write_raw,
363363 .update_scan_mode = adis_update_scan_mode,
364− .driver_module = THIS_MODULE,
365364 };
366365
367366 static const char * const adis16240_status_error_msgs[] = {
drivers/staging/iio/adc/ad7192.c+7−4
@@ -162,6 +162,7 @@ struct ad7192_state { · 161 unmodified lines
162162 u32 scale_avail[8][2];
163163 u8 gpocon;
164164 u8 devid;
165+ struct mutex lock; /* protect sensor state */
165166
166167 struct ad_sigma_delta sd;
167168 };
@@ -461,10 +462,10 @@ static int ad7192_read_raw(struct iio_dev *indio_dev, · 293 unmodified lines
461462 case IIO_CHAN_INFO_SCALE:
462463 switch (chan->type) {
463464 case IIO_VOLTAGE:
464− mutex_lock(&indio_dev->mlock);
465+ mutex_lock(&st->lock);
465466 *val = st->scale_avail[AD7192_CONF_GAIN(st->conf)][0];
466467 *val2 = st->scale_avail[AD7192_CONF_GAIN(st->conf)][1];
467− mutex_unlock(&indio_dev->mlock);
468+ mutex_unlock(&st->lock);
468469 return IIO_VAL_INT_PLUS_NANO;
469470 case IIO_TEMP:
470471 *val = 0;
@@ -508,6 +509,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev, · 37 unmodified lines
508509 switch (mask) {
509510 case IIO_CHAN_INFO_SCALE:
510511 ret = -EINVAL;
512+ mutex_lock(&st->lock);
511513 for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
512514 if (val2 == st->scale_avail[i][1]) {
513515 ret = 0;
@@ -521,6 +523,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev, · 7 unmodified lines
521523 ad7192_calibrate_all(st);
522524 break;
523525 }
526+ mutex_unlock(&st->lock);
524527 break;
525528 case IIO_CHAN_INFO_SAMP_FREQ:
526529 if (!val) {
@@ -567,7 +570,6 @@ static const struct iio_info ad7192_info = { · 40 unmodified lines
567570 .write_raw_get_fmt = ad7192_write_raw_get_fmt,
568571 .attrs = &ad7192_attribute_group,
569572 .validate_trigger = ad_sd_validate_trigger,
570− .driver_module = THIS_MODULE,
571573 };
572574
573575 static const struct iio_info ad7195_info = {
@@ -576,7 +578,6 @@ static const struct iio_info ad7195_info = { · 2 unmodified lines
576578 .write_raw_get_fmt = ad7192_write_raw_get_fmt,
577579 .attrs = &ad7195_attribute_group,
578580 .validate_trigger = ad_sd_validate_trigger,
579− .driver_module = THIS_MODULE,
580581 };
581582
582583 static const struct iio_chan_spec ad7192_channels[] = {
@@ -632,6 +633,8 @@ static int ad7192_probe(struct spi_device *spi) · 49 unmodified lines
632633
633634 st = iio_priv(indio_dev);
634635
636+ mutex_init(&st->lock);
637+
635638 st->avdd = devm_regulator_get(&spi->dev, "avdd");
636639 if (IS_ERR(st->avdd))
637640 return PTR_ERR(st->avdd);
drivers/staging/iio/adc/ad7280a.c+0−1
@@ -828,7 +828,6 @@ static const struct iio_info ad7280_info = { · 827 unmodified lines
828828 .read_raw = ad7280_read_raw,
829829 .event_attrs = &ad7280_event_attrs_group,
830830 .attrs = &ad7280_attrs_group,
831− .driver_module = THIS_MODULE,
832831 };
833832
834833 static const struct ad7280_platform_data ad7793_default_pdata = {
drivers/staging/iio/adc/ad7606.c+0−4
@@ -373,26 +373,22 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) · 372 unmodified lines
373373 };
374374
375375 static const struct iio_info ad7606_info_no_os_or_range = {
376− .driver_module = THIS_MODULE,
377376 .read_raw = &ad7606_read_raw,
378377 };
379378
380379 static const struct iio_info ad7606_info_os_and_range = {
381− .driver_module = THIS_MODULE,
382380 .read_raw = &ad7606_read_raw,
383381 .write_raw = &ad7606_write_raw,
384382 .attrs = &ad7606_attribute_group_os_and_range,
385383 };
386384
387385 static const struct iio_info ad7606_info_os = {
388− .driver_module = THIS_MODULE,
389386 .read_raw = &ad7606_read_raw,
390387 .write_raw = &ad7606_write_raw,
391388 .attrs = &ad7606_attribute_group_os,
392389 };
393390
394391 static const struct iio_info ad7606_info_range = {
395− .driver_module = THIS_MODULE,
396392 .read_raw = &ad7606_read_raw,
397393 .write_raw = &ad7606_write_raw,
398394 .attrs = &ad7606_attribute_group_range,
drivers/staging/iio/adc/ad7780.c+0−1
@@ -155,7 +155,6 @@ static const struct ad7780_chip_info ad7780_chip_info_tbl[] = { · 154 unmodified lines
155155
156156 static const struct iio_info ad7780_info = {
157157 .read_raw = ad7780_read_raw,
158− .driver_module = THIS_MODULE,
159158 };
160159
161160 static int ad7780_probe(struct spi_device *spi)
drivers/staging/iio/adc/ad7816.c+0−1
@@ -335,7 +335,6 @@ static const struct attribute_group ad7816_event_attribute_group = { · 334 unmodified lines
335335 static const struct iio_info ad7816_info = {
336336 .attrs = &ad7816_attribute_group,
337337 .event_attrs = &ad7816_event_attribute_group,
338− .driver_module = THIS_MODULE,
339338 };
340339
341340 /*
drivers/staging/iio/addac/adt7316.c+0−2
@@ -2087,13 +2087,11 @@ EXPORT_SYMBOL_GPL(adt7316_pm_ops); · 2086 unmodified lines
20872087 static const struct iio_info adt7316_info = {
20882088 .attrs = &adt7316_attribute_group,
20892089 .event_attrs = &adt7316_event_attribute_group,
2090− .driver_module = THIS_MODULE,
20912090 };
20922091
20932092 static const struct iio_info adt7516_info = {
20942093 .attrs = &adt7516_attribute_group,
20952094 .event_attrs = &adt7516_event_attribute_group,
2096− .driver_module = THIS_MODULE,
20972095 };
20982096
20992097 /*
drivers/staging/iio/cdc/ad7150.c+0−1
@@ -569,7 +569,6 @@ static const struct attribute_group ad7150_event_attribute_group = { · 568 unmodified lines
569569
570570 static const struct iio_info ad7150_info = {
571571 .event_attrs = &ad7150_event_attribute_group,
572− .driver_module = THIS_MODULE,
573572 .read_raw = &ad7150_read_raw,
574573 .read_event_config = &ad7150_read_event_config,
575574 .write_event_config = &ad7150_write_event_config,
drivers/staging/iio/cdc/ad7152.c+0−1
@@ -441,7 +441,6 @@ static const struct iio_info ad7152_info = { · 440 unmodified lines
441441 .read_raw = ad7152_read_raw,
442442 .write_raw = ad7152_write_raw,
443443 .write_raw_get_fmt = ad7152_write_raw_get_fmt,
444− .driver_module = THIS_MODULE,
445444 };
446445
447446 static const struct iio_chan_spec ad7152_channels[] = {
drivers/staging/iio/cdc/ad7746.c+0−1
@@ -667,7 +667,6 @@ static const struct iio_info ad7746_info = { · 666 unmodified lines
667667 .attrs = &ad7746_attribute_group,
668668 .read_raw = ad7746_read_raw,
669669 .write_raw = ad7746_write_raw,
670− .driver_module = THIS_MODULE,
671670 };
672671
673672 /*
drivers/staging/iio/frequency/ad9832.c+0−1
@@ -290,7 +290,6 @@ static const struct attribute_group ad9832_attribute_group = { · 289 unmodified lines
290290
291291 static const struct iio_info ad9832_info = {
292292 .attrs = &ad9832_attribute_group,
293− .driver_module = THIS_MODULE,
294293 };
295294
296295 static int ad9832_probe(struct spi_device *spi)
drivers/staging/iio/frequency/ad9834.c+0−2
@@ -381,12 +381,10 @@ static const struct attribute_group ad9833_attribute_group = { · 380 unmodified lines
381381
382382 static const struct iio_info ad9834_info = {
383383 .attrs = &ad9834_attribute_group,
384− .driver_module = THIS_MODULE,
385384 };
386385
387386 static const struct iio_info ad9833_info = {
388387 .attrs = &ad9833_attribute_group,
389− .driver_module = THIS_MODULE,
390388 };
391389
392390 static int ad9834_probe(struct spi_device *spi)
drivers/staging/iio/gyro/adis16060_core.c+0−1
@@ -103,7 +103,6 @@ static int adis16060_read_raw(struct iio_dev *indio_dev, · 102 unmodified lines
103103
104104 static const struct iio_info adis16060_info = {
105105 .read_raw = adis16060_read_raw,
106− .driver_module = THIS_MODULE,
107106 };
108107
109108 static const struct iio_chan_spec adis16060_channels[] = {
drivers/staging/iio/impedance-analyzer/ad5933.c+0−1
@@ -575,7 +575,6 @@ out: · 574 unmodified lines
575575 static const struct iio_info ad5933_info = {
576576 .read_raw = ad5933_read_raw,
577577 .attrs = &ad5933_attribute_group,
578− .driver_module = THIS_MODULE,
579578 };
580579
581580 static int ad5933_ring_preenable(struct iio_dev *indio_dev)
drivers/staging/iio/light/tsl2x7x.c+255−410
@@ -15,112 +15,112 @@ · 14 unmodified lines
1515 * more details.
1616 */
1717
18−#include <linux/kernel.h>
19−#include <linux/i2c.h>
20−#include <linux/errno.h>
2118 #include <linux/delay.h>
22−#include <linux/mutex.h>
19+#include <linux/errno.h>
20+#include <linux/i2c.h>
2321 #include <linux/interrupt.h>
24−#include <linux/slab.h>
22+#include <linux/kernel.h>
2523 #include <linux/module.h>
24+#include <linux/mutex.h>
25+#include <linux/slab.h>
2626 #include <linux/iio/events.h>
2727 #include <linux/iio/iio.h>
2828 #include <linux/iio/sysfs.h>
2929 #include "tsl2x7x.h"
3030
3131 /* Cal defs*/
32−#define PROX_STAT_CAL 0
33−#define PROX_STAT_SAMP 1
34−#define MAX_SAMPLES_CAL 200
32+#define PROX_STAT_CAL 0
33+#define PROX_STAT_SAMP 1
34+#define MAX_SAMPLES_CAL 200
3535
3636 /* TSL2X7X Device ID */
37−#define TRITON_ID 0x00
38−#define SWORDFISH_ID 0x30
39−#define HALIBUT_ID 0x20
37+#define TRITON_ID 0x00
38+#define SWORDFISH_ID 0x30
39+#define HALIBUT_ID 0x20
4040
4141 /* Lux calculation constants */
42−#define TSL2X7X_LUX_CALC_OVER_FLOW 65535
42+#define TSL2X7X_LUX_CALC_OVER_FLOW 65535
4343
4444 /* TAOS Register definitions - note:
4545 * depending on device, some of these register are not used and the
4646 * register address is benign.
4747 */
4848 /* 2X7X register offsets */
49−#define TSL2X7X_MAX_CONFIG_REG 16
49+#define TSL2X7X_MAX_CONFIG_REG 16
5050
5151 /* Device Registers and Masks */
52−#define TSL2X7X_CNTRL 0x00
53−#define TSL2X7X_ALS_TIME 0X01
54−#define TSL2X7X_PRX_TIME 0x02
55−#define TSL2X7X_WAIT_TIME 0x03
56−#define TSL2X7X_ALS_MINTHRESHLO 0X04
57−#define TSL2X7X_ALS_MINTHRESHHI 0X05
58−#define TSL2X7X_ALS_MAXTHRESHLO 0X06
59−#define TSL2X7X_ALS_MAXTHRESHHI 0X07
60−#define TSL2X7X_PRX_MINTHRESHLO 0X08
61−#define TSL2X7X_PRX_MINTHRESHHI 0X09
62−#define TSL2X7X_PRX_MAXTHRESHLO 0X0A
63−#define TSL2X7X_PRX_MAXTHRESHHI 0X0B
64−#define TSL2X7X_PERSISTENCE 0x0C
65−#define TSL2X7X_PRX_CONFIG 0x0D
66−#define TSL2X7X_PRX_COUNT 0x0E
67−#define TSL2X7X_GAIN 0x0F
68−#define TSL2X7X_NOTUSED 0x10
69−#define TSL2X7X_REVID 0x11
70−#define TSL2X7X_CHIPID 0x12
71−#define TSL2X7X_STATUS 0x13
72−#define TSL2X7X_ALS_CHAN0LO 0x14
73−#define TSL2X7X_ALS_CHAN0HI 0x15
74−#define TSL2X7X_ALS_CHAN1LO 0x16
75−#define TSL2X7X_ALS_CHAN1HI 0x17
76−#define TSL2X7X_PRX_LO 0x18
77−#define TSL2X7X_PRX_HI 0x19
52+#define TSL2X7X_CNTRL 0x00
53+#define TSL2X7X_ALS_TIME 0X01
54+#define TSL2X7X_PRX_TIME 0x02
55+#define TSL2X7X_WAIT_TIME 0x03
56+#define TSL2X7X_ALS_MINTHRESHLO 0X04
57+#define TSL2X7X_ALS_MINTHRESHHI 0X05
58+#define TSL2X7X_ALS_MAXTHRESHLO 0X06
59+#define TSL2X7X_ALS_MAXTHRESHHI 0X07
60+#define TSL2X7X_PRX_MINTHRESHLO 0X08
61+#define TSL2X7X_PRX_MINTHRESHHI 0X09
62+#define TSL2X7X_PRX_MAXTHRESHLO 0X0A
63+#define TSL2X7X_PRX_MAXTHRESHHI 0X0B
64+#define TSL2X7X_PERSISTENCE 0x0C
65+#define TSL2X7X_PRX_CONFIG 0x0D
66+#define TSL2X7X_PRX_COUNT 0x0E
67+#define TSL2X7X_GAIN 0x0F
68+#define TSL2X7X_NOTUSED 0x10
69+#define TSL2X7X_REVID 0x11
70+#define TSL2X7X_CHIPID 0x12
71+#define TSL2X7X_STATUS 0x13
72+#define TSL2X7X_ALS_CHAN0LO 0x14
73+#define TSL2X7X_ALS_CHAN0HI 0x15
74+#define TSL2X7X_ALS_CHAN1LO 0x16
75+#define TSL2X7X_ALS_CHAN1HI 0x17
76+#define TSL2X7X_PRX_LO 0x18
77+#define TSL2X7X_PRX_HI 0x19
7878
7979 /* tsl2X7X cmd reg masks */
80−#define TSL2X7X_CMD_REG 0x80
81−#define TSL2X7X_CMD_SPL_FN 0x60
80+#define TSL2X7X_CMD_REG 0x80
81+#define TSL2X7X_CMD_SPL_FN 0x60
8282
83−#define TSL2X7X_CMD_PROX_INT_CLR 0X05
84−#define TSL2X7X_CMD_ALS_INT_CLR 0x06
85−#define TSL2X7X_CMD_PROXALS_INT_CLR 0X07
83+#define TSL2X7X_CMD_PROX_INT_CLR 0X05
84+#define TSL2X7X_CMD_ALS_INT_CLR 0x06
85+#define TSL2X7X_CMD_PROXALS_INT_CLR 0X07
8686
8787 /* tsl2X7X cntrl reg masks */
88−#define TSL2X7X_CNTL_ADC_ENBL 0x02
89−#define TSL2X7X_CNTL_PWR_ON 0x01
88+#define TSL2X7X_CNTL_ADC_ENBL 0x02
89+#define TSL2X7X_CNTL_PWR_ON 0x01
9090
9191 /* tsl2X7X status reg masks */
92−#define TSL2X7X_STA_ADC_VALID 0x01
93−#define TSL2X7X_STA_PRX_VALID 0x02
94−#define TSL2X7X_STA_ADC_PRX_VALID (TSL2X7X_STA_ADC_VALID |\
95− TSL2X7X_STA_PRX_VALID)
96−#define TSL2X7X_STA_ALS_INTR 0x10
97−#define TSL2X7X_STA_PRX_INTR 0x20
92+#define TSL2X7X_STA_ADC_VALID 0x01
93+#define TSL2X7X_STA_PRX_VALID 0x02
94+#define TSL2X7X_STA_ADC_PRX_VALID (TSL2X7X_STA_ADC_VALID | \
95+ TSL2X7X_STA_PRX_VALID)
96+#define TSL2X7X_STA_ALS_INTR 0x10
97+#define TSL2X7X_STA_PRX_INTR 0x20
9898
9999 /* tsl2X7X cntrl reg masks */
100−#define TSL2X7X_CNTL_REG_CLEAR 0x00
101−#define TSL2X7X_CNTL_PROX_INT_ENBL 0X20
102−#define TSL2X7X_CNTL_ALS_INT_ENBL 0X10
103−#define TSL2X7X_CNTL_WAIT_TMR_ENBL 0X08
104−#define TSL2X7X_CNTL_PROX_DET_ENBL 0X04
105−#define TSL2X7X_CNTL_PWRON 0x01
106−#define TSL2X7X_CNTL_ALSPON_ENBL 0x03
107−#define TSL2X7X_CNTL_INTALSPON_ENBL 0x13
108−#define TSL2X7X_CNTL_PROXPON_ENBL 0x0F
109−#define TSL2X7X_CNTL_INTPROXPON_ENBL 0x2F
100+#define TSL2X7X_CNTL_REG_CLEAR 0x00
101+#define TSL2X7X_CNTL_PROX_INT_ENBL 0X20
102+#define TSL2X7X_CNTL_ALS_INT_ENBL 0X10
103+#define TSL2X7X_CNTL_WAIT_TMR_ENBL 0X08
104+#define TSL2X7X_CNTL_PROX_DET_ENBL 0X04
105+#define TSL2X7X_CNTL_PWRON 0x01
106+#define TSL2X7X_CNTL_ALSPON_ENBL 0x03
107+#define TSL2X7X_CNTL_INTALSPON_ENBL 0x13
108+#define TSL2X7X_CNTL_PROXPON_ENBL 0x0F
109+#define TSL2X7X_CNTL_INTPROXPON_ENBL 0x2F
110110
111111 /*Prox diode to use */
112−#define TSL2X7X_DIODE0 0x10
113−#define TSL2X7X_DIODE1 0x20
114−#define TSL2X7X_DIODE_BOTH 0x30
112+#define TSL2X7X_DIODE0 0x10
113+#define TSL2X7X_DIODE1 0x20
114+#define TSL2X7X_DIODE_BOTH 0x30
115115
116116 /* LED Power */
117−#define TSL2X7X_mA100 0x00
118−#define TSL2X7X_mA50 0x40
119−#define TSL2X7X_mA25 0x80
120−#define TSL2X7X_mA13 0xD0
121−#define TSL2X7X_MAX_TIMER_CNT (0xFF)
117+#define TSL2X7X_100_mA 0x00
118+#define TSL2X7X_50_mA 0x40
119+#define TSL2X7X_25_mA 0x80
120+#define TSL2X7X_13_mA 0xD0
121+#define TSL2X7X_MAX_TIMER_CNT 0xFF
122122
123−#define TSL2X7X_MIN_ITIME 3
123+#define TSL2X7X_MIN_ITIME 3
124124
125125 /* TAOS txx2x7x Device family members */
126126 enum {
@@ -142,11 +142,6 @@ enum { · 15 unmodified lines
142142 TSL2X7X_CHIP_SUSPENDED = 2
143143 };
144144
145−struct tsl2x7x_parse_result {
146− int integer;
147− int fract;
148−};
149−
150145 /* Per-device data */
151146 struct tsl2x7x_als_info {
152147 u16 als_ch0;
@@ -174,7 +169,7 @@ struct tsl2X7X_chip { · 21 unmodified lines
174169 struct i2c_client *client;
175170 u16 prox_data;
176171 struct tsl2x7x_als_info als_cur_info;
177− struct tsl2x7x_settings tsl2x7x_settings;
172+ struct tsl2x7x_settings settings;
178173 struct tsl2X7X_platform_data *pdata;
179174 int als_time_scale;
180175 int als_saturation;
@@ -192,25 +187,25 @@ struct tsl2X7X_chip { · 11 unmodified lines
192187 };
193188
194189 /* Different devices require different coefficents */
195−static const struct tsl2x7x_lux tsl2x71_lux_table[] = {
190+static const struct tsl2x7x_lux tsl2x71_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] = {
196191 { 14461, 611, 1211 },
197192 { 18540, 352, 623 },
198193 { 0, 0, 0 },
199194 };
200195
201−static const struct tsl2x7x_lux tmd2x71_lux_table[] = {
196+static const struct tsl2x7x_lux tmd2x71_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] = {
202197 { 11635, 115, 256 },
203198 { 15536, 87, 179 },
204199 { 0, 0, 0 },
205200 };
206201
207−static const struct tsl2x7x_lux tsl2x72_lux_table[] = {
202+static const struct tsl2x7x_lux tsl2x72_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] = {
208203 { 14013, 466, 917 },
209204 { 18222, 310, 552 },
210205 { 0, 0, 0 },
211206 };
212207
213−static const struct tsl2x7x_lux tmd2x72_lux_table[] = {
208+static const struct tsl2x7x_lux tmd2x72_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] = {
214209 { 13218, 130, 262 },
215210 { 17592, 92, 169 },
216211 { 0, 0, 0 },
@@ -248,14 +243,14 @@ static const struct tsl2x7x_settings tsl2x7x_default_settings = { · 31 unmodified lines
248243 .prox_pulse_count = 8
249244 };
250245
251−static const s16 tsl2X7X_als_gainadj[] = {
246+static const s16 tsl2x7x_als_gain[] = {
252247 1,
253248 8,
254249 16,
255250 120
256251 };
257252
258−static const s16 tsl2X7X_prx_gainadj[] = {
253+static const s16 tsl2x7x_prx_gain[] = {
259254 1,
260255 2,
261256 4,
@@ -353,9 +348,9 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) · 91 unmodified lines
353348
354349 /* clear any existing interrupt status */
355350 ret = i2c_smbus_write_byte(chip->client,
356− (TSL2X7X_CMD_REG |
351+ TSL2X7X_CMD_REG |
357352 TSL2X7X_CMD_SPL_FN |
358− TSL2X7X_CMD_ALS_INT_CLR));
353+ TSL2X7X_CMD_ALS_INT_CLR);
359354 if (ret < 0) {
360355 dev_err(&chip->client->dev,
361356 "i2c_write_command failed - err = %d\n", ret);
@@ -369,7 +364,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) · 7 unmodified lines
369364 chip->als_cur_info.als_ch0 = ch0;
370365 chip->als_cur_info.als_ch1 = ch1;
371366
372− if ((ch0 >= chip->als_saturation) || (ch1 >= chip->als_saturation)) {
367+ if (ch0 >= chip->als_saturation || ch1 >= chip->als_saturation) {
373368 lux = TSL2X7X_LUX_CALC_OVER_FLOW;
374369 goto return_max;
375370 }
@@ -389,11 +384,10 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) · 13 unmodified lines
389384 if (p->ratio == 0) {
390385 lux = 0;
391386 } else {
392− ch0lux = DIV_ROUND_UP(ch0 * p->ch0,
393− tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]);
394− ch1lux = DIV_ROUND_UP(ch1 * p->ch1,
395− tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain]);
396− lux = ch0lux - ch1lux;
387+ lux = DIV_ROUND_UP(ch0 * p->ch0,
388+ tsl2x7x_als_gain[chip->settings.als_gain]) -
389+ DIV_ROUND_UP(ch1 * p->ch1,
390+ tsl2x7x_als_gain[chip->settings.als_gain]);
397391 }
398392
399393 /* note: lux is 31 bit max at this point */
@@ -419,7 +413,7 @@ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) · 19 unmodified lines
419413 */
420414
421415 lux64 = lux;
422− lux64 = lux64 * chip->tsl2x7x_settings.als_gain_trim;
416+ lux64 = lux64 * chip->settings.als_gain_trim;
423417 lux64 >>= 8;
424418 lux = lux64;
425419 lux = (lux + 500) / 1000;
@@ -472,7 +466,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) · 46 unmodified lines
472466 case tmd2771:
473467 if (!(ret & TSL2X7X_STA_ADC_VALID))
474468 goto prox_poll_err;
475− break;
469+ break;
476470 case tsl2572:
477471 case tsl2672:
478472 case tmd2672:
@@ -480,7 +474,7 @@ static int tsl2x7x_get_prox(struct iio_dev *indio_dev) · 1 unmodified line
480474 case tmd2772:
481475 if (!(ret & TSL2X7X_STA_PRX_VALID))
482476 goto prox_poll_err;
483− break;
477+ break;
484478 }
485479
486480 for (i = 0; i < 2; i++) {
@@ -514,12 +508,10 @@ static void tsl2x7x_defaults(struct tsl2X7X_chip *chip) · 27 unmodified lines
514508 {
515509 /* If Operational settings defined elsewhere.. */
516510 if (chip->pdata && chip->pdata->platform_default_settings)
517− memcpy(&chip->tsl2x7x_settings,
518− chip->pdata->platform_default_settings,
511+ memcpy(&chip->settings, chip->pdata->platform_default_settings,
519512 sizeof(tsl2x7x_default_settings));
520513 else
521− memcpy(&chip->tsl2x7x_settings,
522− &tsl2x7x_default_settings,
514+ memcpy(&chip->settings, &tsl2x7x_default_settings,
523515 sizeof(tsl2x7x_default_settings));
524516
525517 /* Load up the proper lux table. */
@@ -529,8 +521,8 @@ static void tsl2x7x_defaults(struct tsl2X7X_chip *chip) · 3 unmodified lines
529521 sizeof(chip->pdata->platform_lux_table));
530522 else
531523 memcpy(chip->tsl2x7x_device_lux,
532− (struct tsl2x7x_lux *)tsl2x7x_default_lux_table_group[chip->id],
533− MAX_DEFAULT_TABLE_BYTES);
524+ tsl2x7x_default_lux_table_group[chip->id],
525+ TSL2X7X_DEFAULT_TABLE_BYTES);
534526 }
535527
536528 /**
@@ -542,9 +534,7 @@ static void tsl2x7x_defaults(struct tsl2X7X_chip *chip) · 5 unmodified lines
542534 static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev)
543535 {
544536 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
545− int gain_trim_val;
546− int ret;
547− int lux_val;
537+ int ret, lux_val;
548538
549539 ret = i2c_smbus_read_byte_data(chip->client,
550540 TSL2X7X_CMD_REG | TSL2X7X_CNTRL);
@@ -575,16 +565,16 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) · 24 unmodified lines
575565 return lux_val;
576566 }
577567
578− gain_trim_val = ((chip->tsl2x7x_settings.als_cal_target)
579− * chip->tsl2x7x_settings.als_gain_trim) / lux_val;
580− if ((gain_trim_val < 250) || (gain_trim_val > 4000))
568+ ret = (chip->settings.als_cal_target * chip->settings.als_gain_trim) /
569+ lux_val;
570+ if (ret < 250 || ret > 4000)
581571 return -ERANGE;
582572
583− chip->tsl2x7x_settings.als_gain_trim = gain_trim_val;
573+ chip->settings.als_gain_trim = ret;
584574 dev_info(&chip->client->dev,
585575 "%s als_calibrate completed\n", chip->client->name);
586576
587− return (int)gain_trim_val;
577+ return ret;
588578 }
589579
590580 static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
@@ -602,34 +592,30 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) · 11 unmodified lines
602592 chip->pdata->power_on(indio_dev);
603593
604594 /* Non calculated parameters */
605− chip->tsl2x7x_config[TSL2X7X_PRX_TIME] =
606− chip->tsl2x7x_settings.prx_time;
607− chip->tsl2x7x_config[TSL2X7X_WAIT_TIME] =
608− chip->tsl2x7x_settings.wait_time;
609− chip->tsl2x7x_config[TSL2X7X_PRX_CONFIG] =
610− chip->tsl2x7x_settings.prox_config;
595+ chip->tsl2x7x_config[TSL2X7X_PRX_TIME] = chip->settings.prx_time;
596+ chip->tsl2x7x_config[TSL2X7X_WAIT_TIME] = chip->settings.wait_time;
597+ chip->tsl2x7x_config[TSL2X7X_PRX_CONFIG] = chip->settings.prox_config;
611598
612599 chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHLO] =
613− (chip->tsl2x7x_settings.als_thresh_low) & 0xFF;
600+ (chip->settings.als_thresh_low) & 0xFF;
614601 chip->tsl2x7x_config[TSL2X7X_ALS_MINTHRESHHI] =
615− (chip->tsl2x7x_settings.als_thresh_low >> 8) & 0xFF;
602+ (chip->settings.als_thresh_low >> 8) & 0xFF;
616603 chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHLO] =
617− (chip->tsl2x7x_settings.als_thresh_high) & 0xFF;
604+ (chip->settings.als_thresh_high) & 0xFF;
618605 chip->tsl2x7x_config[TSL2X7X_ALS_MAXTHRESHHI] =
619− (chip->tsl2x7x_settings.als_thresh_high >> 8) & 0xFF;
620− chip->tsl2x7x_config[TSL2X7X_PERSISTENCE] =
621− chip->tsl2x7x_settings.persistence;
606+ (chip->settings.als_thresh_high >> 8) & 0xFF;
607+ chip->tsl2x7x_config[TSL2X7X_PERSISTENCE] = chip->settings.persistence;
622608
623609 chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] =
624− chip->tsl2x7x_settings.prox_pulse_count;
610+ chip->settings.prox_pulse_count;
625611 chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] =
626− (chip->tsl2x7x_settings.prox_thres_low) & 0xFF;
612+ (chip->settings.prox_thres_low) & 0xFF;
627613 chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] =
628− (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF;
614+ (chip->settings.prox_thres_low >> 8) & 0xFF;
629615 chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] =
630− (chip->tsl2x7x_settings.prox_thres_high) & 0xFF;
616+ (chip->settings.prox_thres_high) & 0xFF;
631617 chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] =
632− (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF;
618+ (chip->settings.prox_thres_high >> 8) & 0xFF;
633619
634620 /* and make sure we're not already on */
635621 if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) {
@@ -639,7 +625,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) · 3 unmodified lines
639625 }
640626
641627 /* determine als integration register */
642− als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270;
628+ als_count = (chip->settings.als_time * 100 + 135) / 270;
643629 if (!als_count)
644630 als_count = 1; /* ensure at least one cycle */
645631
@@ -649,9 +635,9 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) · 3 unmodified lines
649635
650636 /* Set the gain based on tsl2x7x_settings struct */
651637 chip->tsl2x7x_config[TSL2X7X_GAIN] =
652− chip->tsl2x7x_settings.als_gain |
653− (TSL2X7X_mA100 | TSL2X7X_DIODE1)
654− | ((chip->tsl2x7x_settings.prox_gain) << 2);
638+ chip->settings.als_gain |
639+ (TSL2X7X_100_mA | TSL2X7X_DIODE1) |
640+ (chip->settings.prox_gain << 2);
655641
656642 /* set chip struct re scaling and saturation */
657643 chip->als_saturation = als_count * 922; /* 90% of full scale */
@@ -706,18 +692,18 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) · 48 unmodified lines
706692
707693 chip->tsl2x7x_chip_status = TSL2X7X_CHIP_WORKING;
708694
709− if (chip->tsl2x7x_settings.interrupts_en != 0) {
695+ if (chip->settings.interrupts_en != 0) {
710696 dev_info(&chip->client->dev, "Setting Up Interrupt(s)\n");
711697
712698 reg_val = TSL2X7X_CNTL_PWR_ON | TSL2X7X_CNTL_ADC_ENBL;
713− if ((chip->tsl2x7x_settings.interrupts_en == 0x20) ||
714− (chip->tsl2x7x_settings.interrupts_en == 0x30))
699+ if (chip->settings.interrupts_en == 0x20 ||
700+ chip->settings.interrupts_en == 0x30)
715701 reg_val |= TSL2X7X_CNTL_PROX_DET_ENBL;
716702
717− reg_val |= chip->tsl2x7x_settings.interrupts_en;
703+ reg_val |= chip->settings.interrupts_en;
718704 ret = i2c_smbus_write_byte_data(chip->client,
719− (TSL2X7X_CMD_REG |
720− TSL2X7X_CNTRL), reg_val);
705+ TSL2X7X_CMD_REG | TSL2X7X_CNTRL,
706+ reg_val);
721707 if (ret < 0)
722708 dev_err(&chip->client->dev,
723709 "%s: failed in tsl2x7x_IOCTL_INT_SET.\n",
@@ -766,8 +752,7 @@ static int tsl2x7x_chip_off(struct iio_dev *indio_dev) · 42 unmodified lines
766752 * put device back into proper state, and unlock
767753 * resource.
768754 */
769−static
770−int tsl2x7x_invoke_change(struct iio_dev *indio_dev)
755+static int tsl2x7x_invoke_change(struct iio_dev *indio_dev)
771756 {
772757 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
773758 int device_status = chip->tsl2x7x_chip_status;
@@ -791,9 +776,8 @@ unlock: · 17 unmodified lines
791776 return ret;
792777 }
793778
794−static
795−void tsl2x7x_prox_calculate(int *data, int length,
796− struct tsl2x7x_prox_stat *statP)
779+static void tsl2x7x_prox_calculate(int *data, int length,
780+ struct tsl2x7x_prox_stat *statP)
797781 {
798782 int i;
799783 int sample_sum;
@@ -837,25 +821,25 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) · 37 unmodified lines
837821 u8 tmp_irq_settings;
838822 u8 current_state = chip->tsl2x7x_chip_status;
839823
840− if (chip->tsl2x7x_settings.prox_max_samples_cal > MAX_SAMPLES_CAL) {
824+ if (chip->settings.prox_max_samples_cal > MAX_SAMPLES_CAL) {
841825 dev_err(&chip->client->dev,
842826 "max prox samples cal is too big: %d\n",
843− chip->tsl2x7x_settings.prox_max_samples_cal);
844− chip->tsl2x7x_settings.prox_max_samples_cal = MAX_SAMPLES_CAL;
827+ chip->settings.prox_max_samples_cal);
828+ chip->settings.prox_max_samples_cal = MAX_SAMPLES_CAL;
845829 }
846830
847831 /* have to stop to change settings */
848832 tsl2x7x_chip_off(indio_dev);
849833
850834 /* Enable proximity detection save just in case prox not wanted yet*/
851− tmp_irq_settings = chip->tsl2x7x_settings.interrupts_en;
852− chip->tsl2x7x_settings.interrupts_en |= TSL2X7X_CNTL_PROX_INT_ENBL;
835+ tmp_irq_settings = chip->settings.interrupts_en;
836+ chip->settings.interrupts_en |= TSL2X7X_CNTL_PROX_INT_ENBL;
853837
854838 /*turn on device if not already on*/
855839 tsl2x7x_chip_on(indio_dev);
856840
857841 /*gather the samples*/
858− for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) {
842+ for (i = 0; i < chip->settings.prox_max_samples_cal; i++) {
859843 usleep_range(15000, 17500);
860844 tsl2x7x_get_prox(indio_dev);
861845 prox_history[i] = chip->prox_data;
@@ -866,25 +850,25 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev) · 4 unmodified lines
866850 tsl2x7x_chip_off(indio_dev);
867851 calP = &prox_stat_data[PROX_STAT_CAL];
868852 tsl2x7x_prox_calculate(prox_history,
869− chip->tsl2x7x_settings.prox_max_samples_cal,
870− calP);
871− chip->tsl2x7x_settings.prox_thres_high = (calP->max << 1) - calP->mean;
853+ chip->settings.prox_max_samples_cal, calP);
854+ chip->settings.prox_thres_high = (calP->max << 1) - calP->mean;
872855
873856 dev_info(&chip->client->dev, " cal min=%d mean=%d max=%d\n",
874857 calP->min, calP->mean, calP->max);
875858 dev_info(&chip->client->dev,
876859 "%s proximity threshold set to %d\n",
877− chip->client->name, chip->tsl2x7x_settings.prox_thres_high);
860+ chip->client->name, chip->settings.prox_thres_high);
878861
879862 /* back to the way they were */
880− chip->tsl2x7x_settings.interrupts_en = tmp_irq_settings;
863+ chip->settings.interrupts_en = tmp_irq_settings;
881864 if (current_state == TSL2X7X_CHIP_WORKING)
882865 tsl2x7x_chip_on(indio_dev);
883866 }
884867
885−static ssize_t in_illuminance0_calibscale_available_show(struct device *dev,
886− struct device_attribute *attr,
887− char *buf)
868+static ssize_t
869+in_illuminance0_calibscale_available_show(struct device *dev,
870+ struct device_attribute *attr,
871+ char *buf)
888872 {
889873 struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
890874
@@ -900,69 +884,23 @@ static ssize_t in_illuminance0_calibscale_available_show(struct device *dev, · 9 unmodified lines
900884 return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 120");
901885 }
902886
903−static ssize_t in_proximity0_calibscale_available_show(struct device *dev,
904− struct device_attribute *attr,
905− char *buf)
906−{
907− return snprintf(buf, PAGE_SIZE, "%s\n", "1 2 4 8");
908−}
909−
910−static ssize_t in_illuminance0_integration_time_show(struct device *dev,
911− struct device_attribute *attr,
912− char *buf)
913−{
914− struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
915− int y, z;
916−
917− y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
918− z = y * TSL2X7X_MIN_ITIME;
919− y /= 1000;
920− z %= 1000;
921−
922− return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z);
923−}
924−
925−static ssize_t in_illuminance0_integration_time_store(struct device *dev,
926− struct device_attribute *attr,
927− const char *buf, size_t len)
928−{
929− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
930− struct tsl2X7X_chip *chip = iio_priv(indio_dev);
931− struct tsl2x7x_parse_result result;
932− int ret;
933−
934− ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract);
935− if (ret)
936− return ret;
937−
938− result.fract /= 3;
939− chip->tsl2x7x_settings.als_time =
940− TSL2X7X_MAX_TIMER_CNT - (u8)result.fract;
941−
942− dev_info(&chip->client->dev, "%s: als time = %d",
943− __func__, chip->tsl2x7x_settings.als_time);
944−
945− tsl2x7x_invoke_change(indio_dev);
946−
947− return IIO_VAL_INT_PLUS_MICRO;
948−}
887+static IIO_CONST_ATTR(in_proximity0_calibscale_available, "1 2 4 8");
949888
950889 static IIO_CONST_ATTR(in_illuminance0_integration_time_available,
951890 ".00272 - .696");
952891
953892 static ssize_t in_illuminance0_target_input_show(struct device *dev,
954− struct device_attribute *attr,
955− char *buf)
893+ struct device_attribute *attr,
894+ char *buf)
956895 {
957896 struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
958897
959− return snprintf(buf, PAGE_SIZE, "%d\n",
960− chip->tsl2x7x_settings.als_cal_target);
898+ return snprintf(buf, PAGE_SIZE, "%d\n", chip->settings.als_cal_target);
961899 }
962900
963901 static ssize_t in_illuminance0_target_input_store(struct device *dev,
964− struct device_attribute *attr,
965− const char *buf, size_t len)
902+ struct device_attribute *attr,
903+ const char *buf, size_t len)
966904 {
967905 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
968906 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
@@ -973,7 +911,7 @@ static ssize_t in_illuminance0_target_input_store(struct device *dev, · 4 unmodified lines
973911 return -EINVAL;
974912
975913 if (value)
976− chip->tsl2x7x_settings.als_cal_target = value;
914+ chip->settings.als_cal_target = value;
977915
978916 ret = tsl2x7x_invoke_change(indio_dev);
979917 if (ret < 0)
@@ -982,111 +920,9 @@ static ssize_t in_illuminance0_target_input_store(struct device *dev, · 2 unmodified lines
982920 return len;
983921 }
984922
985−/* persistence settings */
986−static ssize_t in_intensity0_thresh_period_show(struct device *dev,
987− struct device_attribute *attr,
988− char *buf)
989−{
990− struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
991− int y, z, filter_delay;
992−
993− /* Determine integration time */
994− y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
995− z = y * TSL2X7X_MIN_ITIME;
996− filter_delay = z * (chip->tsl2x7x_settings.persistence & 0x0F);
997− y = filter_delay / 1000;
998− z = filter_delay % 1000;
999−
1000− return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z);
1001−}
1002−
1003−static ssize_t in_intensity0_thresh_period_store(struct device *dev,
1004− struct device_attribute *attr,
1005− const char *buf, size_t len)
1006−{
1007− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
1008− struct tsl2X7X_chip *chip = iio_priv(indio_dev);
1009− struct tsl2x7x_parse_result result;
1010− int y, z, filter_delay;
1011− int ret;
1012−
1013− ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract);
1014− if (ret)
1015− return ret;
1016−
1017− y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.als_time) + 1;
1018− z = y * TSL2X7X_MIN_ITIME;
1019−
1020− filter_delay =
1021− DIV_ROUND_UP((result.integer * 1000) + result.fract, z);
1022−
1023− chip->tsl2x7x_settings.persistence &= 0xF0;
1024− chip->tsl2x7x_settings.persistence |= (filter_delay & 0x0F);
1025−
1026− dev_info(&chip->client->dev, "%s: als persistence = %d",
1027− __func__, filter_delay);
1028−
1029− ret = tsl2x7x_invoke_change(indio_dev);
1030− if (ret < 0)
1031− return ret;
1032−
1033− return IIO_VAL_INT_PLUS_MICRO;
1034−}
1035−
1036−static ssize_t in_proximity0_thresh_period_show(struct device *dev,
1037− struct device_attribute *attr,
1038− char *buf)
1039−{
1040− struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
1041− int y, z, filter_delay;
1042−
1043− /* Determine integration time */
1044− y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
1045− z = y * TSL2X7X_MIN_ITIME;
1046− filter_delay = z * ((chip->tsl2x7x_settings.persistence & 0xF0) >> 4);
1047− y = filter_delay / 1000;
1048− z = filter_delay % 1000;
1049−
1050− return snprintf(buf, PAGE_SIZE, "%d.%03d\n", y, z);
1051−}
1052−
1053−static ssize_t in_proximity0_thresh_period_store(struct device *dev,
1054− struct device_attribute *attr,
1055− const char *buf, size_t len)
1056−{
1057− struct iio_dev *indio_dev = dev_to_iio_dev(dev);
1058− struct tsl2X7X_chip *chip = iio_priv(indio_dev);
1059− struct tsl2x7x_parse_result result;
1060− int y, z, filter_delay;
1061− int ret;
1062−
1063− ret = iio_str_to_fixpoint(buf, 100, &result.integer, &result.fract);
1064− if (ret)
1065− return ret;
1066−
1067− y = (TSL2X7X_MAX_TIMER_CNT - (u8)chip->tsl2x7x_settings.prx_time) + 1;
1068− z = y * TSL2X7X_MIN_ITIME;
1069−
1070− filter_delay =
1071− DIV_ROUND_UP((result.integer * 1000) + result.fract, z);
1072−
1073− chip->tsl2x7x_settings.persistence &= 0x0F;
1074− chip->tsl2x7x_settings.persistence |= ((filter_delay << 4) & 0xF0);
1075−
1076− dev_info(&chip->client->dev, "%s: prox persistence = %d",
1077− __func__, filter_delay);
1078−
1079− ret = tsl2x7x_invoke_change(indio_dev);
1080− if (ret < 0)
1081− return ret;
1082−
1083−
1084− return IIO_VAL_INT_PLUS_MICRO;
1085−}
1086−
1087923 static ssize_t in_illuminance0_calibrate_store(struct device *dev,
1088− struct device_attribute *attr,
1089− const char *buf, size_t len)
924+ struct device_attribute *attr,
925+ const char *buf, size_t len)
1090926 {
1091927 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
1092928 bool value;
@@ -1106,14 +942,14 @@ static ssize_t in_illuminance0_calibrate_store(struct device *dev, · 13 unmodified lines
1106942 }
1107943
1108944 static ssize_t in_illuminance0_lux_table_show(struct device *dev,
1109− struct device_attribute *attr,
1110− char *buf)
945+ struct device_attribute *attr,
946+ char *buf)
1111947 {
1112948 struct tsl2X7X_chip *chip = iio_priv(dev_to_iio_dev(dev));
1113949 int i = 0;
1114950 int offset = 0;
1115951
1116− while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) {
952+ while (i < TSL2X7X_MAX_LUX_TABLE_SIZE) {
1117953 offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,",
1118954 chip->tsl2x7x_device_lux[i].ratio,
1119955 chip->tsl2x7x_device_lux[i].ch0,
@@ -1134,8 +970,8 @@ static ssize_t in_illuminance0_lux_table_show(struct device *dev, · 14 unmodified lines
1134970 }
1135971
1136972 static ssize_t in_illuminance0_lux_table_store(struct device *dev,
1137− struct device_attribute *attr,
1138− const char *buf, size_t len)
973+ struct device_attribute *attr,
974+ const char *buf, size_t len)
1139975 {
1140976 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
1141977 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
@@ -1176,8 +1012,8 @@ static ssize_t in_illuminance0_lux_table_store(struct device *dev, · 34 unmodified lines
11761012 }
11771013
11781014 static ssize_t in_proximity0_calibrate_store(struct device *dev,
1179− struct device_attribute *attr,
1180− const char *buf, size_t len)
1015+ struct device_attribute *attr,
1016+ const char *buf, size_t len)
11811017 {
11821018 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
11831019 bool value;
@@ -1205,9 +1041,9 @@ static int tsl2x7x_read_interrupt_config(struct iio_dev *indio_dev, · 21 unmodified lines
12051041 int ret;
12061042
12071043 if (chan->type == IIO_INTENSITY)
1208− ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x10);
1044+ ret = !!(chip->settings.interrupts_en & 0x10);
12091045 else
1210− ret = !!(chip->tsl2x7x_settings.interrupts_en & 0x20);
1046+ ret = !!(chip->settings.interrupts_en & 0x20);
12111047
12121048 return ret;
12131049 }
@@ -1223,14 +1059,14 @@ static int tsl2x7x_write_interrupt_config(struct iio_dev *indio_dev, · 9 unmodified lines
12231059
12241060 if (chan->type == IIO_INTENSITY) {
12251061 if (val)
1226− chip->tsl2x7x_settings.interrupts_en |= 0x10;
1062+ chip->settings.interrupts_en |= 0x10;
12271063 else
1228− chip->tsl2x7x_settings.interrupts_en &= 0x20;
1064+ chip->settings.interrupts_en &= 0x20;
12291065 } else {
12301066 if (val)
1231− chip->tsl2x7x_settings.interrupts_en |= 0x20;
1067+ chip->settings.interrupts_en |= 0x20;
12321068 else
1233− chip->tsl2x7x_settings.interrupts_en &= 0x10;
1069+ chip->settings.interrupts_en &= 0x10;
12341070 }
12351071
12361072 ret = tsl2x7x_invoke_change(indio_dev);
@@ -1248,18 +1084,19 @@ static int tsl2x7x_write_event_value(struct iio_dev *indio_dev, · 11 unmodified lines
12481084 int val, int val2)
12491085 {
12501086 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
1251− int ret = -EINVAL;
1087+ int ret = -EINVAL, y, z, filter_delay;
1088+ u8 time;
12521089
12531090 switch (info) {
12541091 case IIO_EV_INFO_VALUE:
12551092 if (chan->type == IIO_INTENSITY) {
12561093 switch (dir) {
12571094 case IIO_EV_DIR_RISING:
1258− chip->tsl2x7x_settings.als_thresh_high = val;
1095+ chip->settings.als_thresh_high = val;
12591096 ret = 0;
12601097 break;
12611098 case IIO_EV_DIR_FALLING:
1262− chip->tsl2x7x_settings.als_thresh_low = val;
1099+ chip->settings.als_thresh_low = val;
12631100 ret = 0;
12641101 break;
12651102 default:
@@ -1268,11 +1105,11 @@ static int tsl2x7x_write_event_value(struct iio_dev *indio_dev, · 2 unmodified lines
12681105 } else {
12691106 switch (dir) {
12701107 case IIO_EV_DIR_RISING:
1271− chip->tsl2x7x_settings.prox_thres_high = val;
1108+ chip->settings.prox_thres_high = val;
12721109 ret = 0;
12731110 break;
12741111 case IIO_EV_DIR_FALLING:
1275− chip->tsl2x7x_settings.prox_thres_low = val;
1112+ chip->settings.prox_thres_low = val;
12761113 ret = 0;
12771114 break;
12781115 default:
@@ -1280,6 +1117,33 @@ static int tsl2x7x_write_event_value(struct iio_dev *indio_dev, · 1 unmodified line
12801117 }
12811118 }
12821119 break;
1120+ case IIO_EV_INFO_PERIOD:
1121+ if (chan->type == IIO_INTENSITY)
1122+ time = chip->settings.als_time;
1123+ else
1124+ time = chip->settings.prx_time;
1125+
1126+ y = (TSL2X7X_MAX_TIMER_CNT - time) + 1;
1127+ z = y * TSL2X7X_MIN_ITIME;
1128+
1129+ filter_delay = DIV_ROUND_UP((val * 1000) + val2, z);
1130+
1131+ if (chan->type == IIO_INTENSITY) {
1132+ chip->settings.persistence &= 0xF0;
1133+ chip->settings.persistence |=
1134+ (filter_delay & 0x0F);
1135+ dev_info(&chip->client->dev, "%s: ALS persistence = %d",
1136+ __func__, filter_delay);
1137+ } else {
1138+ chip->settings.persistence &= 0x0F;
1139+ chip->settings.persistence |=
1140+ ((filter_delay << 4) & 0xF0);
1141+ dev_info(&chip->client->dev,
1142+ "%s: Proximity persistence = %d",
1143+ __func__, filter_delay);
1144+ }
1145+ ret = 0;
1146+ break;
12831147 default:
12841148 break;
12851149 }
@@ -1298,18 +1162,19 @@ static int tsl2x7x_read_event_value(struct iio_dev *indio_dev, · 12 unmodified lines
12981162 int *val, int *val2)
12991163 {
13001164 struct tsl2X7X_chip *chip = iio_priv(indio_dev);
1301− int ret = -EINVAL;
1165+ int ret = -EINVAL, filter_delay, mult;
1166+ u8 time;
13021167
13031168 switch (info) {
13041169 case IIO_EV_INFO_VALUE:
13051170 if (chan->type == IIO_INTENSITY) {
13061171 switch (dir) {
13071172 case IIO_EV_DIR_RISING:
1308− *val = chip->tsl2x7x_settings.als_thresh_high;
1173+ *val = chip->settings.als_thresh_high;
13091174 ret = IIO_VAL_INT;
13101175 break;
13111176 case IIO_EV_DIR_FALLING:
1312− *val = chip->tsl2x7x_settings.als_thresh_low;
1177+ *val = chip->settings.als_thresh_low;
13131178 ret = IIO_VAL_INT;
13141179 break;
13151180 default:
@@ -1318,11 +1183,11 @@ static int tsl2x7x_read_event_value(struct iio_dev *indio_dev, · 2 unmodified lines
13181183 } else {
13191184 switch (dir) {
13201185 case IIO_EV_DIR_RISING:
1321− *val = chip->tsl2x7x_settings.prox_thres_high;
1186+ *val = chip->settings.prox_thres_high;
13221187 ret = IIO_VAL_INT;
13231188 break;
13241189 case IIO_EV_DIR_FALLING:
1325− *val = chip->tsl2x7x_settings.prox_thres_low;
1190+ *val = chip->settings.prox_thres_low;
13261191 ret = IIO_VAL_INT;
13271192 break;
13281193 default:
@@ -1330,6 +1195,23 @@ static int tsl2x7x_read_event_value(struct iio_dev *indio_dev, · 1 unmodified line
13301195 }
13311196 }
13321197 break;
1198+ case IIO_EV_INFO_PERIOD:
1199+ if (chan->type == IIO_INTENSITY) {
1200+ time = chip->settings.als_time;
1201+ mult = chip->settings.persistence & 0x0F;
1202+ } else {
1203+ time = chip->settings.prx_time;
1204+ mult = (chip->settings.persistence & 0xF0) >> 4;
1205+ }
1206+
1207+ /* Determine integration time */
1208+ *val = (TSL2X7X_MAX_TIMER_CNT - time) + 1;
1209+ *val2 = *val * TSL2X7X_MIN_ITIME;
1210+ filter_delay = *val2 * mult;
1211+ *val = filter_delay / 1000;
1212+ *val2 = filter_delay % 1000;
1213+ ret = IIO_VAL_INT_PLUS_MICRO;
1214+ break;
13331215 default:
13341216 break;
13351217 }
@@ -1379,18 +1261,20 @@ static int tsl2x7x_read_raw(struct iio_dev *indio_dev, · 43 unmodified lines
13791261 break;
13801262 case IIO_CHAN_INFO_CALIBSCALE:
13811263 if (chan->type == IIO_LIGHT)
1382− *val =
1383− tsl2X7X_als_gainadj[chip->tsl2x7x_settings.als_gain];
1264+ *val = tsl2x7x_als_gain[chip->settings.als_gain];
13841265 else
1385− *val =
1386− tsl2X7X_prx_gainadj[chip->tsl2x7x_settings.prox_gain];
1266+ *val = tsl2x7x_prx_gain[chip->settings.prox_gain];
13871267 ret = IIO_VAL_INT;
13881268 break;
13891269 case IIO_CHAN_INFO_CALIBBIAS:
1390− *val = chip->tsl2x7x_settings.als_gain_trim;
1270+ *val = chip->settings.als_gain_trim;
13911271 ret = IIO_VAL_INT;
13921272 break;
1393−
1273+ case IIO_CHAN_INFO_INT_TIME:
1274+ *val = (TSL2X7X_MAX_TIMER_CNT - chip->settings.als_time) + 1;
1275+ *val2 = ((*val * TSL2X7X_MIN_ITIME) % 1000) / 1000;
1276+ ret = IIO_VAL_INT_PLUS_MICRO;
1277+ break;
13941278 default:
13951279 ret = -EINVAL;
13961280 }
@@ -1411,13 +1295,13 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 14 unmodified lines
14111295 if (chan->type == IIO_INTENSITY) {
14121296 switch (val) {
14131297 case 1:
1414− chip->tsl2x7x_settings.als_gain = 0;
1298+ chip->settings.als_gain = 0;
14151299 break;
14161300 case 8:
1417− chip->tsl2x7x_settings.als_gain = 1;
1301+ chip->settings.als_gain = 1;
14181302 break;
14191303 case 16:
1420− chip->tsl2x7x_settings.als_gain = 2;
1304+ chip->settings.als_gain = 2;
14211305 break;
14221306 case 120:
14231307 switch (chip->id) {
@@ -1428,7 +1312,7 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 4 unmodified lines
14281312 case tmd2772:
14291313 return -EINVAL;
14301314 }
1431− chip->tsl2x7x_settings.als_gain = 3;
1315+ chip->settings.als_gain = 3;
14321316 break;
14331317 case 128:
14341318 switch (chip->id) {
@@ -1439,7 +1323,7 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 4 unmodified lines
14391323 case tmd2771:
14401324 return -EINVAL;
14411325 }
1442− chip->tsl2x7x_settings.als_gain = 3;
1326+ chip->settings.als_gain = 3;
14431327 break;
14441328 default:
14451329 return -EINVAL;
@@ -1447,16 +1331,16 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 1 unmodified line
14471331 } else {
14481332 switch (val) {
14491333 case 1:
1450− chip->tsl2x7x_settings.prox_gain = 0;
1334+ chip->settings.prox_gain = 0;
14511335 break;
14521336 case 2:
1453− chip->tsl2x7x_settings.prox_gain = 1;
1337+ chip->settings.prox_gain = 1;
14541338 break;
14551339 case 4:
1456− chip->tsl2x7x_settings.prox_gain = 2;
1340+ chip->settings.prox_gain = 2;
14571341 break;
14581342 case 8:
1459− chip->tsl2x7x_settings.prox_gain = 3;
1343+ chip->settings.prox_gain = 3;
14601344 break;
14611345 default:
14621346 return -EINVAL;
@@ -1464,9 +1348,15 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 1 unmodified line
14641348 }
14651349 break;
14661350 case IIO_CHAN_INFO_CALIBBIAS:
1467− chip->tsl2x7x_settings.als_gain_trim = val;
1351+ chip->settings.als_gain_trim = val;
14681352 break;
1353+ case IIO_CHAN_INFO_INT_TIME:
1354+ chip->settings.als_time =
1355+ TSL2X7X_MAX_TIMER_CNT - (val2 / TSL2X7X_MIN_ITIME);
14691356
1357+ dev_info(&chip->client->dev, "%s: als time = %d",
1358+ __func__, chip->settings.als_time);
1359+ break;
14701360 default:
14711361 return -EINVAL;
14721362 }
@@ -1474,12 +1364,8 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, · 1 unmodified line
14741364 return tsl2x7x_invoke_change(indio_dev);
14751365 }
14761366
1477−static DEVICE_ATTR_RO(in_proximity0_calibscale_available);
1478−
14791367 static DEVICE_ATTR_RO(in_illuminance0_calibscale_available);
14801368
1481−static DEVICE_ATTR_RW(in_illuminance0_integration_time);
1482−
14831369 static DEVICE_ATTR_RW(in_illuminance0_target_input);
14841370
14851371 static DEVICE_ATTR_WO(in_illuminance0_calibrate);
@@ -1488,10 +1374,6 @@ static DEVICE_ATTR_WO(in_proximity0_calibrate); · 2 unmodified lines
14881374
14891375 static DEVICE_ATTR_RW(in_illuminance0_lux_table);
14901376
1491−static DEVICE_ATTR_RW(in_intensity0_thresh_period);
1492−
1493−static DEVICE_ATTR_RW(in_proximity0_thresh_period);
1494−
14951377 /* Use the default register values to identify the Taos device */
14961378 static int tsl2x7x_device_id(int *id, int target)
14971379 {
@@ -1559,7 +1441,6 @@ static irqreturn_t tsl2x7x_event_handler(int irq, void *private) · 61 unmodified lines
15591441
15601442 static struct attribute *tsl2x7x_ALS_device_attrs[] = {
15611443 &dev_attr_in_illuminance0_calibscale_available.attr,
1562− &dev_attr_in_illuminance0_integration_time.attr,
15631444 &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr,
15641445 &dev_attr_in_illuminance0_target_input.attr,
15651446 &dev_attr_in_illuminance0_calibrate.attr,
@@ -1574,49 +1455,31 @@ static struct attribute *tsl2x7x_PRX_device_attrs[] = { · 8 unmodified lines
15741455
15751456 static struct attribute *tsl2x7x_ALSPRX_device_attrs[] = {
15761457 &dev_attr_in_illuminance0_calibscale_available.attr,
1577− &dev_attr_in_illuminance0_integration_time.attr,
15781458 &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr,
15791459 &dev_attr_in_illuminance0_target_input.attr,
15801460 &dev_attr_in_illuminance0_calibrate.attr,
15811461 &dev_attr_in_illuminance0_lux_table.attr,
1582− &dev_attr_in_proximity0_calibrate.attr,
1462+ &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr,
15831463 NULL
15841464 };
15851465
15861466 static struct attribute *tsl2x7x_PRX2_device_attrs[] = {
15871467 &dev_attr_in_proximity0_calibrate.attr,
1588− &dev_attr_in_proximity0_calibscale_available.attr,
1468+ &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr,
15891469 NULL
15901470 };
15911471
15921472 static struct attribute *tsl2x7x_ALSPRX2_device_attrs[] = {
15931473 &dev_attr_in_illuminance0_calibscale_available.attr,
1594− &dev_attr_in_illuminance0_integration_time.attr,
15951474 &iio_const_attr_in_illuminance0_integration_time_available.dev_attr.attr,
15961475 &dev_attr_in_illuminance0_target_input.attr,
15971476 &dev_attr_in_illuminance0_calibrate.attr,
15981477 &dev_attr_in_illuminance0_lux_table.attr,
15991478 &dev_attr_in_proximity0_calibrate.attr,
1600− &dev_attr_in_proximity0_calibscale_available.attr,
1479+ &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr,
16011480 NULL
16021481 };
16031482
1604−static struct attribute *tsl2X7X_ALS_event_attrs[] = {
1605− &dev_attr_in_intensity0_thresh_period.attr,
1606− NULL,
1607−};
1608−
1609−static struct attribute *tsl2X7X_PRX_event_attrs[] = {
1610− &dev_attr_in_proximity0_thresh_period.attr,
1611− NULL,
1612−};
1613−
1614−static struct attribute *tsl2X7X_ALSPRX_event_attrs[] = {
1615− &dev_attr_in_intensity0_thresh_period.attr,
1616− &dev_attr_in_proximity0_thresh_period.attr,
1617− NULL,
1618−};
1619−
16201483 static const struct attribute_group tsl2X7X_device_attr_group_tbl[] = {
16211484 [ALS] = {
16221485 .attrs = tsl2x7x_ALS_device_attrs,
@@ -1635,26 +1498,9 @@ static const struct attribute_group tsl2X7X_device_attr_group_tbl[] = { · 12 unmodified lines
16351498 },
16361499 };
16371500
1638−static const struct attribute_group tsl2X7X_event_attr_group_tbl[] = {
1639− [ALS] = {
1640− .attrs = tsl2X7X_ALS_event_attrs,
1641− .name = "events",
1642− },
1643− [PRX] = {
1644− .attrs = tsl2X7X_PRX_event_attrs,
1645− .name = "events",
1646− },
1647− [ALSPRX] = {
1648− .attrs = tsl2X7X_ALSPRX_event_attrs,
1649− .name = "events",
1650− },
1651−};
1652−
16531501 static const struct iio_info tsl2X7X_device_info[] = {
16541502 [ALS] = {
16551503 .attrs = &tsl2X7X_device_attr_group_tbl[ALS],
1656− .event_attrs = &tsl2X7X_event_attr_group_tbl[ALS],
1657− .driver_module = THIS_MODULE,
16581504 .read_raw = &tsl2x7x_read_raw,
16591505 .write_raw = &tsl2x7x_write_raw,
16601506 .read_event_value = &tsl2x7x_read_event_value,
@@ -1664,8 +1510,6 @@ static const struct iio_info tsl2X7X_device_info[] = { · 3 unmodified lines
16641510 },
16651511 [PRX] = {
16661512 .attrs = &tsl2X7X_device_attr_group_tbl[PRX],
1667− .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX],
1668− .driver_module = THIS_MODULE,
16691513 .read_raw = &tsl2x7x_read_raw,
16701514 .write_raw = &tsl2x7x_write_raw,
16711515 .read_event_value = &tsl2x7x_read_event_value,
@@ -1675,8 +1519,6 @@ static const struct iio_info tsl2X7X_device_info[] = { · 3 unmodified lines
16751519 },
16761520 [ALSPRX] = {
16771521 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX],
1678− .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX],
1679− .driver_module = THIS_MODULE,
16801522 .read_raw = &tsl2x7x_read_raw,
16811523 .write_raw = &tsl2x7x_write_raw,
16821524 .read_event_value = &tsl2x7x_read_event_value,
@@ -1686,8 +1528,6 @@ static const struct iio_info tsl2X7X_device_info[] = { · 3 unmodified lines
16861528 },
16871529 [PRX2] = {
16881530 .attrs = &tsl2X7X_device_attr_group_tbl[PRX2],
1689− .event_attrs = &tsl2X7X_event_attr_group_tbl[PRX],
1690− .driver_module = THIS_MODULE,
16911531 .read_raw = &tsl2x7x_read_raw,
16921532 .write_raw = &tsl2x7x_write_raw,
16931533 .read_event_value = &tsl2x7x_read_event_value,
@@ -1697,8 +1537,6 @@ static const struct iio_info tsl2X7X_device_info[] = { · 3 unmodified lines
16971537 },
16981538 [ALSPRX2] = {
16991539 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX2],
1700− .event_attrs = &tsl2X7X_event_attr_group_tbl[ALSPRX],
1701− .driver_module = THIS_MODULE,
17021540 .read_raw = &tsl2x7x_read_raw,
17031541 .write_raw = &tsl2x7x_write_raw,
17041542 .read_event_value = &tsl2x7x_read_event_value,
@@ -1719,6 +1557,10 @@ static const struct iio_event_spec tsl2x7x_events[] = { · 14 unmodified lines
17191557 .dir = IIO_EV_DIR_FALLING,
17201558 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
17211559 BIT(IIO_EV_INFO_ENABLE),
1560+ }, {
1561+ .type = IIO_EV_TYPE_THRESH,
1562+ .dir = IIO_EV_DIR_EITHER,
1563+ .mask_separate = BIT(IIO_EV_INFO_PERIOD),
17221564 },
17231565 };
17241566
@@ -1729,7 +1571,8 @@ static const struct tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { · 4 unmodified lines
17291571 .type = IIO_LIGHT,
17301572 .indexed = 1,
17311573 .channel = 0,
1732− .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
1574+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
1575+ BIT(IIO_CHAN_INFO_INT_TIME),
17331576 }, {
17341577 .type = IIO_INTENSITY,
17351578 .indexed = 1,
@@ -1768,7 +1611,8 @@ static const struct tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { · 32 unmodified lines
17681611 .type = IIO_LIGHT,
17691612 .indexed = 1,
17701613 .channel = 0,
1771− .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED)
1614+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
1615+ BIT(IIO_CHAN_INFO_INT_TIME),
17721616 }, {
17731617 .type = IIO_INTENSITY,
17741618 .indexed = 1,
@@ -1816,7 +1660,8 @@ static const struct tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { · 41 unmodified lines
18161660 .type = IIO_LIGHT,
18171661 .indexed = 1,
18181662 .channel = 0,
1819− .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
1663+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
1664+ BIT(IIO_CHAN_INFO_INT_TIME),
18201665 }, {
18211666 .type = IIO_INTENSITY,
18221667 .indexed = 1,
@@ -1874,7 +1719,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp, · 51 unmodified lines
18741719 return -EINVAL;
18751720 }
18761721
1877− ret = i2c_smbus_write_byte(clientp, (TSL2X7X_CMD_REG | TSL2X7X_CNTRL));
1722+ ret = i2c_smbus_write_byte(clientp, TSL2X7X_CMD_REG | TSL2X7X_CNTRL);
18781723 if (ret < 0) {
18791724 dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n",
18801725 ret);
@@ -1982,7 +1827,7 @@ static int tsl2x7x_remove(struct i2c_client *client) · 101 unmodified lines
19821827 return 0;
19831828 }
19841829
1985−static struct i2c_device_id tsl2x7x_idtable[] = {
1830+static const struct i2c_device_id tsl2x7x_idtable[] = {
19861831 { "tsl2571", tsl2571 },
19871832 { "tsl2671", tsl2671 },
19881833 { "tmd2671", tmd2671 },
drivers/staging/iio/light/tsl2x7x.h+7−6
@@ -23,18 +23,19 @@ · 22 unmodified lines
2323 #define __TSL2X7X_H
2424 #include <linux/pm.h>
2525
26−/* Max number of segments allowable in LUX table */
27−#define TSL2X7X_MAX_LUX_TABLE_SIZE 9
28−#define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE)
29−
30−struct iio_dev;
31−
3226 struct tsl2x7x_lux {
3327 unsigned int ratio;
3428 unsigned int ch0;
3529 unsigned int ch1;
3630 };
3731
32+/* Max number of segments allowable in LUX table */
33+#define TSL2X7X_MAX_LUX_TABLE_SIZE 9
34+/* The default LUX tables all have 3 elements. */
35+#define TSL2X7X_DEF_LUX_TABLE_SZ 3
36+#define TSL2X7X_DEFAULT_TABLE_BYTES (sizeof(struct tsl2x7x_lux) * \
37+ TSL2X7X_DEF_LUX_TABLE_SZ)
38+
3839 /**
3940 * struct tsl2x7x_default_settings - power on defaults unless
4041 * overridden by platform data.
drivers/staging/iio/meter/ade7753.c+18−9
@@ -80,7 +80,7 @@ · 79 unmodified lines
8080 * @us: actual spi_device
8181 * @tx: transmit buffer
8282 * @rx: receive buffer
83− * @buf_lock: mutex to protect tx and rx
83+ * @buf_lock: mutex to protect tx, rx and write frequency
8484 **/
8585 struct ade7753_state {
8686 struct spi_device *us;
@@ -107,6 +107,19 @@ static int ade7753_spi_write_reg_8(struct device *dev, · 20 unmodified lines
107107 return ret;
108108 }
109109
110+static int __ade7753_spi_write_reg_16(struct device *dev, u8 reg_address,
111+ u16 value)
112+{
113+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
114+ struct ade7753_state *st = iio_priv(indio_dev);
115+
116+ st->tx[0] = ADE7753_WRITE_REG(reg_address);
117+ st->tx[1] = (value >> 8) & 0xFF;
118+ st->tx[2] = value & 0xFF;
119+
120+ return spi_write(st->us, st->tx, 3);
121+}
122+
110123 static int ade7753_spi_write_reg_16(struct device *dev, u8 reg_address,
111124 u16 value)
112125 {
@@ -115,10 +128,7 @@ static int ade7753_spi_write_reg_16(struct device *dev, u8 reg_address, · 2 unmodified lines
115128 struct ade7753_state *st = iio_priv(indio_dev);
116129
117130 mutex_lock(&st->buf_lock);
118− st->tx[0] = ADE7753_WRITE_REG(reg_address);
119− st->tx[1] = (value >> 8) & 0xFF;
120− st->tx[2] = value & 0xFF;
121− ret = spi_write(st->us, st->tx, 3);
131+ ret = __ade7753_spi_write_reg_16(dev, reg_address, value);
122132 mutex_unlock(&st->buf_lock);
123133
124134 return ret;
@@ -483,7 +493,7 @@ static ssize_t ade7753_write_frequency(struct device *dev, · 358 unmodified lines
483493 if (!val)
484494 return -EINVAL;
485495
486− mutex_lock(&indio_dev->mlock);
496+ mutex_lock(&st->buf_lock);
487497
488498 t = 27900 / val;
489499 if (t > 0)
@@ -501,10 +511,10 @@ static ssize_t ade7753_write_frequency(struct device *dev, · 11 unmodified lines
501511 reg &= ~(3 << 11);
502512 reg |= t << 11;
503513
504− ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg);
514+ ret = __ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg);
505515
506516 out:
507− mutex_unlock(&indio_dev->mlock);
517+ mutex_unlock(&st->buf_lock);
508518
509519 return ret ? ret : len;
510520 }
@@ -561,7 +571,6 @@ static const struct attribute_group ade7753_attribute_group = { · 50 unmodified lines
561571
562572 static const struct iio_info ade7753_info = {
563573 .attrs = &ade7753_attribute_group,
564− .driver_module = THIS_MODULE,
565574 };
566575
567576 static int ade7753_probe(struct spi_device *spi)
drivers/staging/iio/meter/ade7754.c+0−1
@@ -601,7 +601,6 @@ static const struct attribute_group ade7754_attribute_group = { · 600 unmodified lines
601601
602602 static const struct iio_info ade7754_info = {
603603 .attrs = &ade7754_attribute_group,
604− .driver_module = THIS_MODULE,
605604 };
606605
607606 static int ade7754_probe(struct spi_device *spi)
drivers/staging/iio/meter/ade7758_core.c+0−1
@@ -827,7 +827,6 @@ static const struct iio_info ade7758_info = { · 826 unmodified lines
827827 .attrs = &ade7758_attribute_group,
828828 .read_raw = &ade7758_read_raw,
829829 .write_raw = &ade7758_write_raw,
830− .driver_module = THIS_MODULE,
831830 };
832831
833832 static int ade7758_probe(struct spi_device *spi)
drivers/staging/iio/meter/ade7758_trigger.c+0−1
@@ -53,7 +53,6 @@ static int ade7758_trig_try_reen(struct iio_trigger *trig) · 52 unmodified lines
5353 }
5454
5555 static const struct iio_trigger_ops ade7758_trigger_ops = {
56− .owner = THIS_MODULE,
5756 .set_trigger_state = &ade7758_data_rdy_trigger_set_state,
5857 .try_reenable = &ade7758_trig_try_reen,
5958 };
drivers/staging/iio/meter/ade7759.c+19−9
@@ -60,7 +60,7 @@ · 59 unmodified lines
6060 /**
6161 * struct ade7759_state - device instance specific data
6262 * @us: actual spi_device
63− * @buf_lock: mutex to protect tx and rx
63+ * @buf_lock: mutex to protect tx and rx and write frequency
6464 * @tx: transmit buffer
6565 * @rx: receive buffer
6666 **/
@@ -89,19 +89,30 @@ static int ade7759_spi_write_reg_8(struct device *dev, · 22 unmodified lines
8989 return ret;
9090 }
9191
92−static int ade7759_spi_write_reg_16(struct device *dev,
92+/*Unlocked version of ade7759_spi_write_reg_16 function */
93+static int __ade7759_spi_write_reg_16(struct device *dev,
9394 u8 reg_address,
9495 u16 value)
9596 {
96− int ret;
9797 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
9898 struct ade7759_state *st = iio_priv(indio_dev);
9999
100− mutex_lock(&st->buf_lock);
101100 st->tx[0] = ADE7759_WRITE_REG(reg_address);
102101 st->tx[1] = (value >> 8) & 0xFF;
103102 st->tx[2] = value & 0xFF;
104− ret = spi_write(st->us, st->tx, 3);
103+ return spi_write(st->us, st->tx, 3);
104+}
105+
106+static int ade7759_spi_write_reg_16(struct device *dev,
107+ u8 reg_address,
108+ u16 value)
109+{
110+ int ret;
111+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
112+ struct ade7759_state *st = iio_priv(indio_dev);
113+
114+ mutex_lock(&st->buf_lock);
115+ ret = __ade7759_spi_write_reg_16(dev, reg_address, value);
105116 mutex_unlock(&st->buf_lock);
106117
107118 return ret;
@@ -429,7 +440,7 @@ static ssize_t ade7759_write_frequency(struct device *dev, · 321 unmodified lines
429440 if (!val)
430441 return -EINVAL;
431442
432− mutex_lock(&indio_dev->mlock);
443+ mutex_lock(&st->buf_lock);
433444
434445 t = 27900 / val;
435446 if (t > 0)
@@ -447,10 +458,10 @@ static ssize_t ade7759_write_frequency(struct device *dev, · 11 unmodified lines
447458 reg &= ~(3 << 13);
448459 reg |= t << 13;
449460
450− ret = ade7759_spi_write_reg_16(dev, ADE7759_MODE, reg);
461+ ret = __ade7759_spi_write_reg_16(dev, ADE7759_MODE, reg);
451462
452463 out:
453− mutex_unlock(&indio_dev->mlock);
464+ mutex_unlock(&st->buf_lock);
454465
455466 return ret ? ret : len;
456467 }
@@ -493,7 +504,6 @@ static const struct attribute_group ade7759_attribute_group = { · 36 unmodified lines
493504
494505 static const struct iio_info ade7759_info = {
495506 .attrs = &ade7759_attribute_group,
496− .driver_module = THIS_MODULE,
497507 };
498508
499509 static int ade7759_probe(struct spi_device *spi)
drivers/staging/iio/meter/ade7854.c+0−1
@@ -530,7 +530,6 @@ static const struct attribute_group ade7854_attribute_group = { · 529 unmodified lines
530530
531531 static const struct iio_info ade7854_info = {
532532 .attrs = &ade7854_attribute_group,
533− .driver_module = THIS_MODULE,
534533 };
535534
536535 int ade7854_probe(struct iio_dev *indio_dev, struct device *dev)
drivers/staging/iio/resolver/ad2s1200.c+0−1
@@ -98,7 +98,6 @@ static const struct iio_chan_spec ad2s1200_channels[] = { · 97 unmodified lines
9898
9999 static const struct iio_info ad2s1200_info = {
100100 .read_raw = ad2s1200_read_raw,
101− .driver_module = THIS_MODULE,
102101 };
103102
104103 static int ad2s1200_probe(struct spi_device *spi)
drivers/staging/iio/resolver/ad2s1210.c+0−1
@@ -638,7 +638,6 @@ error_ret: · 637 unmodified lines
638638 static const struct iio_info ad2s1210_info = {
639639 .read_raw = ad2s1210_read_raw,
640640 .attrs = &ad2s1210_attribute_group,
641− .driver_module = THIS_MODULE,
642641 };
643642
644643 static int ad2s1210_setup_gpios(struct ad2s1210_state *st)
drivers/staging/iio/resolver/ad2s90.c+0−1
@@ -48,7 +48,6 @@ error_ret: · 47 unmodified lines
4848
4949 static const struct iio_info ad2s90_info = {
5050 .read_raw = ad2s90_read_raw,
51− .driver_module = THIS_MODULE,
5251 };
5352
5453 static const struct iio_chan_spec ad2s90_chan = {
drivers/staging/iio/trigger/iio-trig-bfin-timer.c+0−1
@@ -172,7 +172,6 @@ static int iio_bfin_tmr_get_number(int irq) · 171 unmodified lines
172172 }
173173
174174 static const struct iio_trigger_ops iio_bfin_tmr_trigger_ops = {
175− .owner = THIS_MODULE,
176175 .set_trigger_state = iio_bfin_tmr_set_state,
177176 };
178177
drivers/staging/irda/drivers/ali-ircc.c+1−2
@@ -1876,8 +1876,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self) · 1875 unmodified lines
18761876 self->stamp = ktime_get();
18771877
18781878 skb = dev_alloc_skb(len+1);
1879− if (skb == NULL)
1880− {
1879+ if (!skb) {
18811880 self->netdev->stats.rx_dropped++;
18821881
18831882 return FALSE;
drivers/staging/irda/drivers/au1k_ir.c+18−22
@@ -290,8 +290,7 @@ static int au1k_irda_set_speed(struct net_device *dev, int speed) · 289 unmodified lines
290290 while (irda_read(aup, IR_STATUS) & (IR_RX_STATUS | IR_TX_STATUS)) {
291291 msleep(20);
292292 if (!timeout--) {
293− printk(KERN_ERR "%s: rx/tx disable timeout\n",
294− dev->name);
293+ netdev_err(dev, "rx/tx disable timeout\n");
295294 break;
296295 }
297296 }
@@ -349,7 +348,7 @@ static int au1k_irda_set_speed(struct net_device *dev, int speed) · 51 unmodified lines
349348 IR_RX_ENABLE);
350349 break;
351350 default:
352− printk(KERN_ERR "%s unsupported speed %x\n", dev->name, speed);
351+ netdev_err(dev, "unsupported speed %x\n", speed);
353352 ret = -EINVAL;
354353 break;
355354 }
@@ -361,18 +360,18 @@ static int au1k_irda_set_speed(struct net_device *dev, int speed) · 5 unmodified lines
361360 irda_write(aup, IR_RING_PROMPT, 0);
362361
363362 if (control & (1 << 14)) {
364− printk(KERN_ERR "%s: configuration error\n", dev->name);
363+ netdev_err(dev, "configuration error\n");
365364 } else {
366365 if (control & (1 << 11))
367− printk(KERN_DEBUG "%s Valid SIR config\n", dev->name);
366+ netdev_debug(dev, "Valid SIR config\n");
368367 if (control & (1 << 12))
369− printk(KERN_DEBUG "%s Valid MIR config\n", dev->name);
368+ netdev_debug(dev, "Valid MIR config\n");
370369 if (control & (1 << 13))
371− printk(KERN_DEBUG "%s Valid FIR config\n", dev->name);
370+ netdev_debug(dev, "Valid FIR config\n");
372371 if (control & (1 << 10))
373− printk(KERN_DEBUG "%s TX enabled\n", dev->name);
372+ netdev_debug(dev, "TX enabled\n");
374373 if (control & (1 << 9))
375− printk(KERN_DEBUG "%s RX enabled\n", dev->name);
374+ netdev_debug(dev, "RX enabled\n");
376375 }
377376
378377 return ret;
@@ -584,23 +583,21 @@ static int au1k_irda_start(struct net_device *dev) · 205 unmodified lines
584583
585584 retval = au1k_init(dev);
586585 if (retval) {
587− printk(KERN_ERR "%s: error in au1k_init\n", dev->name);
586+ netdev_err(dev, "error in au1k_init\n");
588587 return retval;
589588 }
590589
591590 retval = request_irq(aup->irq_tx, &au1k_irda_interrupt, 0,
592591 dev->name, dev);
593592 if (retval) {
594− printk(KERN_ERR "%s: unable to get IRQ %d\n",
595− dev->name, dev->irq);
593+ netdev_err(dev, "unable to get IRQ %d\n", dev->irq);
596594 return retval;
597595 }
598596 retval = request_irq(aup->irq_rx, &au1k_irda_interrupt, 0,
599597 dev->name, dev);
600598 if (retval) {
601599 free_irq(aup->irq_tx, dev);
602− printk(KERN_ERR "%s: unable to get IRQ %d\n",
603− dev->name, dev->irq);
600+ netdev_err(dev, "unable to get IRQ %d\n", dev->irq);
604601 return retval;
605602 }
606603
@@ -673,12 +670,12 @@ static int au1k_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) · 66 unmodified lines
673670 flags = ptxd->flags;
674671
675672 if (flags & AU_OWN) {
676− printk(KERN_DEBUG "%s: tx_full\n", dev->name);
673+ netdev_debug(dev, "tx_full\n");
677674 netif_stop_queue(dev);
678675 aup->tx_full = 1;
679676 return 1;
680677 } else if (((aup->tx_head + 1) & (NUM_IR_DESC - 1)) == aup->tx_tail) {
681− printk(KERN_DEBUG "%s: tx_full\n", dev->name);
678+ netdev_debug(dev, "tx_full\n");
682679 netif_stop_queue(dev);
683680 aup->tx_full = 1;
684681 return 1;
@@ -688,7 +685,7 @@ static int au1k_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines
688685
689686 #if 0
690687 if (irda_read(aup, IR_RX_BYTE_CNT) != 0) {
691− printk(KERN_DEBUG "tx warning: rx byte cnt %x\n",
688+ netdev_debug(dev, "tx warning: rx byte cnt %x\n",
692689 irda_read(aup, IR_RX_BYTE_CNT));
693690 }
694691 #endif
@@ -726,7 +723,7 @@ static void au1k_tx_timeout(struct net_device *dev) · 31 unmodified lines
726723 u32 speed;
727724 struct au1k_private *aup = netdev_priv(dev);
728725
729− printk(KERN_ERR "%s: tx timeout\n", dev->name);
726+ netdev_err(dev, "tx timeout\n");
730727 speed = aup->speed;
731728 aup->speed = 0;
732729 au1k_irda_set_speed(dev, speed);
@@ -751,8 +748,7 @@ static int au1k_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) · 18 unmodified lines
751748 ret = au1k_irda_set_speed(dev,
752749 rq->ifr_baudrate);
753750 else {
754− printk(KERN_ERR "%s ioctl: !netif_running\n",
755− dev->name);
751+ netdev_err(dev, "ioctl: !netif_running\n");
756752 ret = 0;
757753 }
758754 }
@@ -868,7 +864,7 @@ out3: · 109 unmodified lines
868864 out2:
869865 kfree(aup->rx_buff.head);
870866 out1:
871− printk(KERN_ERR "au1k_irda_net_init() failed. Returns %d\n", retval);
867+ netdev_err(dev, "au1k_irda_net_init() failed. Returns %d\n");
872868 return retval;
873869 }
874870
@@ -934,7 +930,7 @@ static int au1k_irda_probe(struct platform_device *pdev) · 59 unmodified lines
934930
935931 platform_set_drvdata(pdev, dev);
936932
937− printk(KERN_INFO "IrDA: Registered device %s\n", dev->name);
933+ netdev_info(dev, "IrDA: Registered device\n");
938934 return 0;
939935
940936 out4:
drivers/staging/irda/drivers/bfin_sir.c+7−5
@@ -22,6 +22,8 @@ static int max_rate = 57600; · 21 unmodified lines
2222 static int max_rate = 115200;
2323 #endif
2424
25+static void bfin_sir_rx_dma_timeout(struct timer_list *t);
26+
2527 static void turnaround_delay(int mtt)
2628 {
2729 long ticks;
@@ -57,7 +59,7 @@ static void bfin_sir_init_ports(struct bfin_sir_port *sp, struct platform_device · 29 unmodified lines
5759 sp->clk = get_sclk();
5860 #ifdef CONFIG_SIR_BFIN_DMA
5961 sp->tx_done = 1;
60− init_timer(&(sp->rx_dma_timer));
62+ timer_setup(&sp->rx_dma_timer, bfin_sir_rx_dma_timeout, 0);
6163 #endif
6264 }
6365
@@ -317,10 +319,12 @@ static void bfin_sir_dma_rx_chars(struct net_device *dev) · 253 unmodified lines
317319 async_unwrap_char(dev, &self->stats, &self->rx_buff, port->rx_dma_buf.buf[i]);
318320 }
319321
320−void bfin_sir_rx_dma_timeout(struct net_device *dev)
322+static void bfin_sir_rx_dma_timeout(struct timer_list *t)
321323 {
324+ struct bfin_sir_port *port = from_timer(port, t, rx_dma_timer);
325+ struct net_device *dev = port->dev;
322326 struct bfin_sir_self *self = netdev_priv(dev);
323− struct bfin_sir_port *port = self->sir_port;
327+
324328 int x_pos, pos;
325329 unsigned long flags;
326330
@@ -405,8 +409,6 @@ static int bfin_sir_startup(struct bfin_sir_port *port, struct net_device *dev) · 78 unmodified lines
405409 set_dma_start_addr(port->rx_dma_channel, (unsigned long)port->rx_dma_buf.buf);
406410 enable_dma(port->rx_dma_channel);
407411
408− port->rx_dma_timer.data = (unsigned long)(dev);
409− port->rx_dma_timer.function = (void *)bfin_sir_rx_dma_timeout;
410412
411413 #else
412414
drivers/staging/irda/drivers/esi-sir.c+11−11
@@ -1,5 +1,5 @@
11 /*********************************************************************
2− *
2+ *
33 * Filename: esi.c
44 * Version: 1.6
55 * Description: Driver for the Extended Systems JetEye PC dongle
@@ -8,25 +8,25 @@ · 2 unmodified lines
88 * Created at: Sat Feb 21 18:54:38 1998
99 * Modified at: Sun Oct 27 22:01:04 2002
1010 * Modified by: Martin Diehl <mad@mdiehl.de>
11− *
11+ *
1212 * Copyright (c) 1999 Dag Brattli, <dagb@cs.uit.no>,
1313 * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
1414 * Copyright (c) 2002 Martin Diehl, <mad@mdiehl.de>,
1515 * All Rights Reserved.
16− *
17− * This program is free software; you can redistribute it and/or
18− * modify it under the terms of the GNU General Public License as
19− * published by the Free Software Foundation; either version 2 of
16+ *
17+ * This program is free software; you can redistribute it and/or
18+ * modify it under the terms of the GNU General Public License as
19+ * published by the Free Software Foundation; either version 2 of
2020 * the License, or (at your option) any later version.
21− *
21+ *
2222 * This program is distributed in the hope that it will be useful,
2323 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2424 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2525 * GNU General Public License for more details.
26− *
27− * You should have received a copy of the GNU General Public License
26+ *
27+ * You should have received a copy of the GNU General Public License
2828 * along with this program; if not, see <http://www.gnu.org/licenses/>.
29− *
29+ *
3030 ********************************************************************/
3131
3232 #include <linux/module.h>
@@ -97,7 +97,7 @@ static int esi_change_speed(struct sir_dev *dev, unsigned speed) · 64 unmodified lines
9797 {
9898 int ret = 0;
9999 int dtr, rts;
100−
100+
101101 switch (speed) {
102102 case 19200:
103103 dtr = TRUE;
drivers/staging/irda/drivers/irda-usb.c+8−16
@@ -117,7 +117,7 @@ static void irda_usb_close(struct irda_usb_cb *self); · 116 unmodified lines
117117 static void speed_bulk_callback(struct urb *urb);
118118 static void write_bulk_callback(struct urb *urb);
119119 static void irda_usb_receive(struct urb *urb);
120−static void irda_usb_rx_defer_expired(unsigned long data);
120+static void irda_usb_rx_defer_expired(struct timer_list *t);
121121 static int irda_usb_net_open(struct net_device *dev);
122122 static int irda_usb_net_close(struct net_device *dev);
123123 static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -334,9 +334,9 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) · 210 unmodified lines
334334 urb->transfer_flags = 0;
335335
336336 /* Irq disabled -> GFP_ATOMIC */
337− if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
337+ ret = usb_submit_urb(urb, GFP_ATOMIC);
338+ if (ret)
338339 net_warn_ratelimited("%s(), failed Speed URB\n", __func__);
339− }
340340 }
341341
342342 /*------------------------------------------------------------------*/
@@ -846,8 +846,7 @@ static void irda_usb_receive(struct urb *urb) · 503 unmodified lines
846846 * hot unplug of the dongle...
847847 * Lowest effective timer is 10ms...
848848 * Jean II */
849− self->rx_defer_timer.function = irda_usb_rx_defer_expired;
850− self->rx_defer_timer.data = (unsigned long) urb;
849+ self->rx_defer_timer_urb = urb;
851850 mod_timer(&self->rx_defer_timer,
852851 jiffies + msecs_to_jiffies(10));
853852
@@ -953,20 +952,13 @@ done: · 99 unmodified lines
953952 * In case of errors, we want the USB layer to have time to recover.
954953 * Now, it is time to resubmit ouur Rx URB...
955954 */
956−static void irda_usb_rx_defer_expired(unsigned long data)
955+static void irda_usb_rx_defer_expired(struct timer_list *t)
957956 {
958− struct urb *urb = (struct urb *) data;
957+ struct irda_usb_cb *self = from_timer(self, t, rx_defer_timer);
958+ struct urb *urb = self->rx_defer_timer_urb;
959959 struct sk_buff *skb = (struct sk_buff *) urb->context;
960− struct irda_usb_cb *self;
961− struct irda_skb_cb *cb;
962960 struct urb *next_urb;
963961
964− /* Find ourselves */
965− cb = (struct irda_skb_cb *) skb->cb;
966− IRDA_ASSERT(cb != NULL, return;);
967− self = (struct irda_usb_cb *) cb->context;
968− IRDA_ASSERT(self != NULL, return;);
969−
970962 /* Same stuff as when Rx is done, see above... */
971963 next_urb = self->idle_rx_urb;
972964 urb->context = NULL;
@@ -1622,7 +1614,7 @@ static int irda_usb_probe(struct usb_interface *intf, · 649 unmodified lines
16221614 self = netdev_priv(net);
16231615 self->netdev = net;
16241616 spin_lock_init(&self->lock);
1625− init_timer(&self->rx_defer_timer);
1617+ timer_setup(&self->rx_defer_timer, irda_usb_rx_defer_expired, 0);
16261618
16271619 self->capability = id->driver_info;
16281620 self->needspatch = ((self->capability & IUC_STIR421X) != 0);
drivers/staging/irda/drivers/irda-usb.h+1−0
@@ -170,5 +170,6 @@ struct irda_usb_cb { · 169 unmodified lines
170170 int needspatch; /* device needs firmware patch */
171171
172172 struct timer_list rx_defer_timer; /* Wait for Rx error to clear */
173+ struct urb *rx_defer_timer_urb; /* URB attached to rx_defer_timer */
173174 };
174175
drivers/staging/irda/drivers/mcs7780.c+6−3
@@ -605,19 +605,22 @@ static int mcs_speed_change(struct mcs_cb *mcs) · 604 unmodified lines
605605 if (mcs->new_speed <= 115200) {
606606 rval &= ~MCS_FIR;
607607
608− if ((rst = (mcs->speed > 115200)))
608+ rst = mcs->speed > 115200;
609+ if (rst)
609610 mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
610611
611612 } else if (mcs->new_speed <= 1152000) {
612613 rval &= ~MCS_FIR;
613614
614− if ((rst = !(mcs->speed == 576000 || mcs->speed == 1152000)))
615+ rst = !(mcs->speed == 576000 || mcs->speed == 1152000);
616+ if (rst)
615617 mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
616618
617619 } else {
618620 rval |= MCS_FIR;
619621
620− if ((rst = (mcs->speed != 4000000)))
622+ rst = mcs->speed != 4000000;
623+ if (rst)
621624 mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
622625
623626 }
drivers/staging/irda/drivers/vlsi_ir.c+9−9
@@ -170,10 +170,10 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev) · 169 unmodified lines
170170 seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state);
171171 seq_printf(seq, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n",
172172 pdev->irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev->dma_mask);
173− seq_printf(seq, "hw registers: ");
173+ seq_puts(seq, "hw registers: ");
174174 for (i = 0; i < 0x20; i++)
175175 seq_printf(seq, "%02x", (unsigned)inb((iobase+i)));
176− seq_printf(seq, "\n");
176+ seq_putc(seq, '\n');
177177 }
178178
179179 static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev)
@@ -193,7 +193,7 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev) · 13 unmodified lines
193193 if (!netif_running(ndev))
194194 return;
195195
196− seq_printf(seq, "\nhw-state:\n");
196+ seq_puts(seq, "\nhw-state:\n");
197197 pci_read_config_byte(idev->pdev, VLSI_PCI_IRMISC, &byte);
198198 seq_printf(seq, "IRMISC:%s%s%s uart%s",
199199 (byte&IRMISC_IRRAIL) ? " irrail" : "",
@@ -274,7 +274,7 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev) · 74 unmodified lines
274274 word = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
275275 seq_printf(seq, "RCVBCNT: rx-fifo filling level = %u\n", word);
276276
277− seq_printf(seq, "\nsw-state:\n");
277+ seq_puts(seq, "\nsw-state:\n");
278278 seq_printf(seq, "IrPHY setup: %d baud - %s encoding\n", idev->baud,
279279 (idev->mode==IFF_SIR)?"SIR":((idev->mode==IFF_MIR)?"MIR":"FIR"));
280280 sec = div_s64_rem(ktime_us_delta(ktime_get(), idev->last_rx),
@@ -305,10 +305,10 @@ static void vlsi_proc_ring(struct seq_file *seq, struct vlsi_ring *r) · 24 unmodified lines
305305 t = atomic_read(&r->tail) & r->mask;
306306 seq_printf(seq, "head = %d / tail = %d ", h, t);
307307 if (h == t)
308− seq_printf(seq, "(empty)\n");
308+ seq_puts(seq, "(empty)\n");
309309 else {
310310 if (((t+1)&r->mask) == h)
311− seq_printf(seq, "(full)\n");
311+ seq_puts(seq, "(full)\n");
312312 else
313313 seq_printf(seq, "(level = %d)\n", ((unsigned)(t-h) & r->mask));
314314 rd = &r->rd[h];
@@ -355,13 +355,13 @@ static int vlsi_seq_show(struct seq_file *seq, void *v) · 40 unmodified lines
355355 seq_printf(seq, "\nPCI controller down - resume_ok = %d\n",
356356 idev->resume_ok);
357357 if (netif_running(ndev) && idev->rx_ring && idev->tx_ring) {
358− seq_printf(seq, "\n--------- RX ring -----------\n\n");
358+ seq_puts(seq, "\n--------- RX ring -----------\n\n");
359359 vlsi_proc_ring(seq, idev->rx_ring);
360− seq_printf(seq, "\n--------- TX ring -----------\n\n");
360+ seq_puts(seq, "\n--------- TX ring -----------\n\n");
361361 vlsi_proc_ring(seq, idev->tx_ring);
362362 }
363363 }
364− seq_printf(seq, "\n");
364+ seq_putc(seq, '\n');
365365 spin_unlock_irqrestore(&idev->lock, flags);
366366
367367 return 0;
drivers/staging/irda/include/net/irda/irlmp_event.h+3−3
@@ -82,9 +82,9 @@ typedef enum { · 81 unmodified lines
8282 extern const char *const irlmp_state[];
8383 extern const char *const irlsap_state[];
8484
85−void irlmp_watchdog_timer_expired(void *data);
86−void irlmp_discovery_timer_expired(void *data);
87−void irlmp_idle_timer_expired(void *data);
85+void irlmp_watchdog_timer_expired(struct timer_list *t);
86+void irlmp_discovery_timer_expired(struct timer_list *t);
87+void irlmp_idle_timer_expired(struct timer_list *t);
8888
8989 void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
9090 struct sk_buff *skb);
drivers/staging/irda/include/net/irda/qos.h+10−10
@@ -58,23 +58,23 @@ · 57 unmodified lines
5858 #define IR_16000000 0x02
5959
6060 /* Quality of Service information */
61−typedef struct {
61+struct qos_value {
6262 __u32 value;
6363 __u16 bits; /* LSB is first byte, MSB is second byte */
64−} qos_value_t;
64+};
6565
6666 struct qos_info {
6767 magic_t magic;
6868
69− qos_value_t baud_rate; /* IR_11520O | ... */
70− qos_value_t max_turn_time;
71− qos_value_t data_size;
72− qos_value_t window_size;
73− qos_value_t additional_bofs;
74− qos_value_t min_turn_time;
75− qos_value_t link_disc_time;
69+ struct qos_value baud_rate; /* IR_11520O | ... */
70+ struct qos_value max_turn_time;
71+ struct qos_value data_size;
72+ struct qos_value window_size;
73+ struct qos_value additional_bofs;
74+ struct qos_value min_turn_time;
75+ struct qos_value link_disc_time;
7676
77− qos_value_t power;
77+ struct qos_value power;
7878 };
7979
8080 extern int sysctl_max_baud_rate;
drivers/staging/irda/include/net/irda/timer.h+4−7
@@ -72,14 +72,11 @@ struct lap_cb; · 71 unmodified lines
7272
7373 #define WATCHDOG_TIMEOUT (20*HZ) /* 20 sec */
7474
75−typedef void (*TIMER_CALLBACK)(void *);
76−
77−static inline void irda_start_timer(struct timer_list *ptimer, int timeout,
78− void* data, TIMER_CALLBACK callback)
75+static inline void irda_start_timer(struct timer_list *ptimer, int timeout,
76+ void (*callback)(struct timer_list *))
7977 {
80− ptimer->function = (void (*)(unsigned long)) callback;
81− ptimer->data = (unsigned long) data;
82−
78+ ptimer->function = (TIMER_FUNC_TYPE) callback;
79+
8380 /* Set new value for timer (update or add timer).
8481 * We use mod_timer() because it's more efficient and also
8582 * safer with respect to race conditions - Jean II */
drivers/staging/irda/net/af_irda.c+3−4
@@ -429,11 +429,11 @@ static void irda_selective_discovery_indication(discinfo_t *discovery, · 428 unmodified lines
429429 * We were waiting for a node to be discovered, but nothing has come up
430430 * so far. Wake up the user and tell him that we failed...
431431 */
432−static void irda_discovery_timeout(u_long priv)
432+static void irda_discovery_timeout(struct timer_list *t)
433433 {
434434 struct irda_sock *self;
435435
436− self = (struct irda_sock *) priv;
436+ self = from_timer(self, t, watchdog);
437437 BUG_ON(self == NULL);
438438
439439 /* Nothing for the caller */
@@ -2505,8 +2505,7 @@ bed: · 2065 unmodified lines
25052505
25062506 /* Set watchdog timer to expire in <val> ms. */
25072507 self->errno = 0;
2508− setup_timer(&self->watchdog, irda_discovery_timeout,
2509− (unsigned long)self);
2508+ timer_setup(&self->watchdog, irda_discovery_timeout, 0);
25102509 mod_timer(&self->watchdog,
25112510 jiffies + msecs_to_jiffies(val));
25122511
drivers/staging/irda/net/discovery.c+2−2
@@ -179,7 +179,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force) · 178 unmodified lines
179179 /* Create the client specific buffer */
180180 n = HASHBIN_GET_SIZE(log);
181181 buffer = kmalloc(n * sizeof(struct irda_device_info), GFP_ATOMIC);
182− if (buffer == NULL) {
182+ if (!buffer) {
183183 spin_unlock_irqrestore(&log->hb_spinlock, flags);
184184 return;
185185 }
@@ -291,7 +291,7 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, · 105 unmodified lines
291291 /* Create the client specific buffer */
292292 n = HASHBIN_GET_SIZE(log);
293293 buffer = kmalloc(n * sizeof(struct irda_device_info), GFP_ATOMIC);
294− if (buffer == NULL) {
294+ if (!buffer) {
295295 spin_unlock_irqrestore(&log->hb_spinlock, flags);
296296 return NULL;
297297 }
drivers/staging/irda/net/ircomm/ircomm_tty.c+1−1
@@ -395,7 +395,7 @@ static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) · 394 unmodified lines
395395 self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED;
396396
397397 /* Init some important stuff */
398− init_timer(&self->watchdog_timer);
398+ timer_setup(&self->watchdog_timer, NULL, 0);
399399 spin_lock_init(&self->spinlock);
400400
401401 /*
drivers/staging/irda/net/ircomm/ircomm_tty_attach.c+4−4
@@ -52,7 +52,7 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, · 51 unmodified lines
5252 struct ias_value *value, void *priv);
5353 static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
5454 int timeout);
55−static void ircomm_tty_watchdog_timer_expired(void *data);
55+static void ircomm_tty_watchdog_timer_expired(struct timer_list *timer);
5656
5757 static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
5858 IRCOMM_TTY_EVENT event,
@@ -587,7 +587,7 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, · 528 unmodified lines
587587 IRDA_ASSERT(self != NULL, return;);
588588 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
589589
590− irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
590+ irda_start_timer(&self->watchdog_timer, timeout,
591591 ircomm_tty_watchdog_timer_expired);
592592 }
593593
@@ -597,9 +597,9 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, · 3 unmodified lines
597597 * Called when the connect procedure have taken to much time.
598598 *
599599 */
600−static void ircomm_tty_watchdog_timer_expired(void *data)
600+static void ircomm_tty_watchdog_timer_expired(struct timer_list *t)
601601 {
602− struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
602+ struct ircomm_tty_cb *self = from_timer(self, t, watchdog_timer);
603603
604604 IRDA_ASSERT(self != NULL, return;);
605605 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
drivers/staging/irda/net/irda_device.c+18−18
@@ -54,29 +54,30 @@ · 53 unmodified lines
5454
5555 static void __irda_task_delete(struct irda_task *task);
5656
57−static hashbin_t *dongles = NULL;
58−static hashbin_t *tasks = NULL;
57+static hashbin_t *dongles;
58+static hashbin_t *tasks;
5959
60−static void irda_task_timer_expired(void *data);
60+static void irda_task_timer_expired(struct timer_list *timer);
6161
62−int __init irda_device_init( void)
62+int __init irda_device_init(void)
6363 {
6464 dongles = hashbin_new(HB_NOLOCK);
65− if (dongles == NULL) {
65+ if (!dongles) {
6666 net_warn_ratelimited("IrDA: Can't allocate dongles hashbin!\n");
6767 return -ENOMEM;
6868 }
6969 spin_lock_init(&dongles->hb_spinlock);
7070
7171 tasks = hashbin_new(HB_LOCK);
72− if (tasks == NULL) {
72+ if (!tasks) {
7373 net_warn_ratelimited("IrDA: Can't allocate tasks hashbin!\n");
7474 hashbin_delete(dongles, NULL);
7575 return -ENOMEM;
7676 }
7777
7878 /* We no longer initialise the driver ourselves here, we let
79− * the system do it for us... - Jean II */
79+ * the system do it for us... - Jean II
80+ */
8081
8182 return 0;
8283 }
@@ -84,6 +85,7 @@ int __init irda_device_init( void) · 1 unmodified line
8485 static void leftover_dongle(void *arg)
8586 {
8687 struct dongle_reg *reg = arg;
88+
8789 net_warn_ratelimited("IrDA: Dongle type %x not unregistered\n",
8890 reg->type);
8991 }
@@ -107,7 +109,7 @@ void irda_device_set_media_busy(struct net_device *dev, int status) · 17 unmodified lines
107109
108110 pr_debug("%s(%s)\n", __func__, status ? "TRUE" : "FALSE");
109111
110− self = (struct irlap_cb *) dev->atalk_ptr;
112+ self = (struct irlap_cb *)dev->atalk_ptr;
111113
112114 /* Some drivers may enable the receive interrupt before calling
113115 * irlap_open(), or they may disable the receive interrupt
@@ -115,7 +117,8 @@ void irda_device_set_media_busy(struct net_device *dev, int status) · 1 unmodified line
115117 * The IrDA stack is protected from this in irlap_driver_rcv().
116118 * However, the driver calls directly the wrapper, that calls
117119 * us directly. Make sure we protect ourselves.
118− * Jean II */
120+ * Jean II
121+ */
119122 if (!self || self->magic != LAP_MAGIC)
120123 return;
121124
@@ -133,7 +136,6 @@ void irda_device_set_media_busy(struct net_device *dev, int status) · 11 unmodified lines
133136 }
134137 EXPORT_SYMBOL(irda_device_set_media_busy);
135138
136−
137139 /*
138140 * Function irda_device_is_receiving (dev)
139141 *
@@ -169,7 +171,7 @@ static void __irda_task_delete(struct irda_task *task) · 29 unmodified lines
169171 static void irda_task_delete(struct irda_task *task)
170172 {
171173 /* Unregister task */
172− hashbin_remove(tasks, (long) task, NULL);
174+ hashbin_remove(tasks, (long)task, NULL);
173175
174176 __irda_task_delete(task);
175177 }
@@ -231,7 +233,7 @@ static int irda_task_kick(struct irda_task *task) · 55 unmodified lines
231233 }
232234 irda_task_delete(task);
233235 } else if (timeout > 0) {
234− irda_start_timer(&task->timer, timeout, (void *) task,
236+ irda_start_timer(&task->timer, timeout,
235237 irda_task_timer_expired);
236238 finished = FALSE;
237239 } else {
@@ -249,11 +251,9 @@ static int irda_task_kick(struct irda_task *task) · 11 unmodified lines
249251 * Task time has expired. We now try to execute task (again), and restart
250252 * the timer if the task has not finished yet
251253 */
252−static void irda_task_timer_expired(void *data)
254+static void irda_task_timer_expired(struct timer_list *t)
253255 {
254− struct irda_task *task;
255−
256− task = data;
256+ struct irda_task *task = from_timer(task, t, timer);
257257
258258 irda_task_kick(task);
259259 }
@@ -280,8 +280,8 @@ static void irda_device_setup(struct net_device *dev) · 20 unmodified lines
280280
281281 /*
282282 * Funciton alloc_irdadev
283− * Allocates and sets up an IRDA device in a manner similar to
284− * alloc_etherdev.
283+ * Allocates and sets up an IRDA device in a manner similar to
284+ * alloc_etherdev.
285285 */
286286 struct net_device *alloc_irdadev(int sizeof_priv)
287287 {
drivers/staging/irda/net/iriap.c+5−5
@@ -76,12 +76,12 @@ static void iriap_connect_confirm(void *instance, void *sap, · 75 unmodified lines
7676 static int iriap_data_indication(void *instance, void *sap,
7777 struct sk_buff *skb);
7878
79−static void iriap_watchdog_timer_expired(void *data);
79+static void iriap_watchdog_timer_expired(struct timer_list *t);
8080
8181 static inline void iriap_start_watchdog_timer(struct iriap_cb *self,
8282 int timeout)
8383 {
84− irda_start_timer(&self->watchdog_timer, timeout, self,
84+ irda_start_timer(&self->watchdog_timer, timeout,
8585 iriap_watchdog_timer_expired);
8686 }
8787
@@ -199,7 +199,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv, · 111 unmodified lines
199199 * we connect, so this must have a sane value... Jean II */
200200 self->max_header_size = LMP_MAX_HEADER;
201201
202− init_timer(&self->watchdog_timer);
202+ timer_setup(&self->watchdog_timer, NULL, 0);
203203
204204 hashbin_insert(iriap, (irda_queue_t *) self, (long) self, NULL);
205205
@@ -946,9 +946,9 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb) · 740 unmodified lines
946946 * Query has taken too long time, so abort
947947 *
948948 */
949−static void iriap_watchdog_timer_expired(void *data)
949+static void iriap_watchdog_timer_expired(struct timer_list *t)
950950 {
951− struct iriap_cb *self = (struct iriap_cb *) data;
951+ struct iriap_cb *self = from_timer(self, t, watchdog_timer);
952952
953953 IRDA_ASSERT(self != NULL, return;);
954954 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
drivers/staging/irda/net/irlan/irlan_client.c+3−3
@@ -68,9 +68,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, · 67 unmodified lines
6868 char *value, int val_len);
6969 static void irlan_client_open_ctrl_tsap(struct irlan_cb *self);
7070
71−static void irlan_client_kick_timer_expired(void *data)
71+static void irlan_client_kick_timer_expired(struct timer_list *t)
7272 {
73− struct irlan_cb *self = (struct irlan_cb *) data;
73+ struct irlan_cb *self = from_timer(self, t, client.kick_timer);
7474
7575 IRDA_ASSERT(self != NULL, return;);
7676 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -89,7 +89,7 @@ static void irlan_client_kick_timer_expired(void *data) · 12 unmodified lines
8989
9090 static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout)
9191 {
92− irda_start_timer(&self->client.kick_timer, timeout, (void *) self,
92+ irda_start_timer(&self->client.kick_timer, timeout,
9393 irlan_client_kick_timer_expired);
9494 }
9595
drivers/staging/irda/net/irlan/irlan_common.c+2−2
@@ -228,8 +228,8 @@ static struct irlan_cb __init *irlan_open(__u32 saddr, __u32 daddr) · 227 unmodified lines
228228
229229 self->media = MEDIA_802_3;
230230 self->disconnect_reason = LM_USER_REQUEST;
231− init_timer(&self->watchdog_timer);
232− init_timer(&self->client.kick_timer);
231+ timer_setup(&self->watchdog_timer, NULL, 0);
232+ timer_setup(&self->client.kick_timer, NULL, 0);
233233 init_waitqueue_head(&self->open_wait);
234234
235235 skb_queue_head_init(&self->client.txq);
drivers/staging/irda/net/irlap.c+8−8
@@ -148,14 +148,14 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, · 147 unmodified lines
148148 /* Copy to the driver */
149149 memcpy(dev->dev_addr, &self->saddr, 4);
150150
151− init_timer(&self->slot_timer);
152− init_timer(&self->query_timer);
153− init_timer(&self->discovery_timer);
154− init_timer(&self->final_timer);
155− init_timer(&self->poll_timer);
156− init_timer(&self->wd_timer);
157− init_timer(&self->backoff_timer);
158− init_timer(&self->media_busy_timer);
151+ timer_setup(&self->slot_timer, NULL, 0);
152+ timer_setup(&self->query_timer, NULL, 0);
153+ timer_setup(&self->discovery_timer, NULL, 0);
154+ timer_setup(&self->final_timer, NULL, 0);
155+ timer_setup(&self->poll_timer, NULL, 0);
156+ timer_setup(&self->wd_timer, NULL, 0);
157+ timer_setup(&self->backoff_timer, NULL, 0);
158+ timer_setup(&self->media_busy_timer, NULL, 0);
159159
160160 irlap_apply_default_connection_parameters(self);
161161
drivers/staging/irda/net/irlap_event.c+3−3
@@ -163,9 +163,9 @@ static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event, · 162 unmodified lines
163163 * Poll timer has expired. Normally we must now send a RR frame to the
164164 * remote device
165165 */
166−static void irlap_poll_timer_expired(void *data)
166+static void irlap_poll_timer_expired(struct timer_list *t)
167167 {
168− struct irlap_cb *self = (struct irlap_cb *) data;
168+ struct irlap_cb *self = from_timer(self, t, poll_timer);
169169
170170 IRDA_ASSERT(self != NULL, return;);
171171 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -222,7 +222,7 @@ static void irlap_start_poll_timer(struct irlap_cb *self, int timeout) · 50 unmodified lines
222222 if (timeout == 0)
223223 irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
224224 else
225− irda_start_timer(&self->poll_timer, timeout, self,
225+ irda_start_timer(&self->poll_timer, timeout,
226226 irlap_poll_timer_expired);
227227 }
228228
drivers/staging/irda/net/irlmp.c+4−4
@@ -109,7 +109,7 @@ int __init irlmp_init(void) · 108 unmodified lines
109109 irlmp->last_lsap_sel = 0x0f; /* Reserved 0x00-0x0f */
110110 strcpy(sysctl_devname, "Linux");
111111
112− init_timer(&irlmp->discovery_timer);
112+ timer_setup(&irlmp->discovery_timer, NULL, 0);
113113
114114 /* Do discovery every 3 seconds, conditionally */
115115 if (sysctl_discovery)
@@ -185,7 +185,7 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify, __u8 pid) · 69 unmodified lines
185185 self->dlsap_sel = LSAP_ANY;
186186 /* self->connected = FALSE; -> already NULL via memset() */
187187
188− init_timer(&self->watchdog_timer);
188+ timer_setup(&self->watchdog_timer, NULL, 0);
189189
190190 self->notify = *notify;
191191
@@ -311,7 +311,7 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify) · 119 unmodified lines
311311
312312 lap->lap_state = LAP_STANDBY;
313313
314− init_timer(&lap->idle_timer);
314+ timer_setup(&lap->idle_timer, NULL, 0);
315315
316316 /*
317317 * Insert into queue of LMP links
@@ -655,7 +655,7 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance) · 337 unmodified lines
655655 /* Not everything is the same */
656656 new->notify.instance = instance;
657657
658− init_timer(&new->watchdog_timer);
658+ timer_setup(&new->watchdog_timer, NULL, 0);
659659
660660 hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) new,
661661 (long) new, NULL);
drivers/staging/irda/net/irlmp_event.c+5−5
@@ -165,7 +165,7 @@ void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event, · 164 unmodified lines
165165 (*lap_state[self->lap_state]) (self, event, skb);
166166 }
167167
168−void irlmp_discovery_timer_expired(void *data)
168+void irlmp_discovery_timer_expired(struct timer_list *t)
169169 {
170170 /* We always cleanup the log (active & passive discovery) */
171171 irlmp_do_expiry();
@@ -176,9 +176,9 @@ void irlmp_discovery_timer_expired(void *data) · 4 unmodified lines
176176 irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout * HZ);
177177 }
178178
179−void irlmp_watchdog_timer_expired(void *data)
179+void irlmp_watchdog_timer_expired(struct timer_list *t)
180180 {
181− struct lsap_cb *self = (struct lsap_cb *) data;
181+ struct lsap_cb *self = from_timer(self, t, watchdog_timer);
182182
183183 IRDA_ASSERT(self != NULL, return;);
184184 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -186,9 +186,9 @@ void irlmp_watchdog_timer_expired(void *data) · 1 unmodified line
186186 irlmp_do_lsap_event(self, LM_WATCHDOG_TIMEOUT, NULL);
187187 }
188188
189−void irlmp_idle_timer_expired(void *data)
189+void irlmp_idle_timer_expired(struct timer_list *t)
190190 {
191− struct lap_cb *self = (struct lap_cb *) data;
191+ struct lap_cb *self = from_timer(self, t, idle_timer);
192192
193193 IRDA_ASSERT(self != NULL, return;);
194194 IRDA_ASSERT(self->magic == LMP_LAP_MAGIC, return;);
drivers/staging/irda/net/irqueue.c+2−1
@@ -217,7 +217,8 @@ static __u32 hash( const char* name) · 216 unmodified lines
217217
218218 while(*name) {
219219 h = (h<<4) + *name++;
220− if ((g = (h & 0xf0000000)))
220+ g = h & 0xf0000000;
221+ if (g)
221222 h ^=g>>24;
222223 h &=~g;
223224 }
drivers/staging/irda/net/irttp.c+3−8
@@ -62,7 +62,6 @@ static void irttp_run_rx_queue(struct tsap_cb *self); · 61 unmodified lines
6262 static void irttp_flush_queues(struct tsap_cb *self);
6363 static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb);
6464 static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self);
65−static void irttp_todo_expired(unsigned long data);
6665 static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
6766 int get);
6867
@@ -160,9 +159,9 @@ static inline void irttp_start_todo_timer(struct tsap_cb *self, int timeout) · 91 unmodified lines
160159 * killed (need user context), and we can't guarantee that here...
161160 * Jean II
162161 */
163−static void irttp_todo_expired(unsigned long data)
162+static void irttp_todo_expired(struct timer_list *t)
164163 {
165− struct tsap_cb *self = (struct tsap_cb *) data;
164+ struct tsap_cb *self = from_timer(self, t, todo_timer);
166165
167166 /* Check that we still exist */
168167 if (!self || self->magic != TTP_TSAP_MAGIC)
@@ -374,7 +373,7 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, · 205 unmodified lines
374373 static void irttp_init_tsap(struct tsap_cb *tsap)
375374 {
376375 spin_lock_init(&tsap->lock);
377− init_timer(&tsap->todo_timer);
376+ timer_setup(&tsap->todo_timer, irttp_todo_expired, 0);
378377
379378 skb_queue_head_init(&tsap->rx_queue);
380379 skb_queue_head_init(&tsap->tx_queue);
@@ -410,10 +409,6 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) · 29 unmodified lines
410409 /* Initialize internal objects */
411410 irttp_init_tsap(self);
412411
413− /* Initialise todo timer */
414− self->todo_timer.data = (unsigned long) self;
415− self->todo_timer.function = &irttp_todo_expired;
416−
417412 /* Initialize callbacks for IrLMP to use */
418413 irda_notify_init(&ttp_notify);
419414 ttp_notify.connect_confirm = irttp_connect_confirm;
drivers/staging/irda/net/timer.c+27−27
@@ -34,16 +34,16 @@ · 33 unmodified lines
3434
3535 extern int sysctl_slot_timeout;
3636
37−static void irlap_slot_timer_expired(void* data);
38−static void irlap_query_timer_expired(void* data);
39−static void irlap_final_timer_expired(void* data);
40−static void irlap_wd_timer_expired(void* data);
41−static void irlap_backoff_timer_expired(void* data);
42−static void irlap_media_busy_expired(void* data);
37+static void irlap_slot_timer_expired(struct timer_list *t);
38+static void irlap_query_timer_expired(struct timer_list *t);
39+static void irlap_final_timer_expired(struct timer_list *t);
40+static void irlap_wd_timer_expired(struct timer_list *t);
41+static void irlap_backoff_timer_expired(struct timer_list *t);
42+static void irlap_media_busy_expired(struct timer_list *t);
4343
4444 void irlap_start_slot_timer(struct irlap_cb *self, int timeout)
4545 {
46− irda_start_timer(&self->slot_timer, timeout, (void *) self,
46+ irda_start_timer(&self->slot_timer, timeout,
4747 irlap_slot_timer_expired);
4848 }
4949
@@ -66,32 +66,32 @@ void irlap_start_query_timer(struct irlap_cb *self, int S, int s) · 16 unmodified lines
6666 /* Set or re-set the timer. We reset the timer for each received
6767 * discovery query, which allow us to automatically adjust to
6868 * the speed of the peer discovery (faster or slower). Jean II */
69− irda_start_timer( &self->query_timer, timeout, (void *) self,
69+ irda_start_timer(&self->query_timer, timeout,
7070 irlap_query_timer_expired);
7171 }
7272
7373 void irlap_start_final_timer(struct irlap_cb *self, int timeout)
7474 {
75− irda_start_timer(&self->final_timer, timeout, (void *) self,
75+ irda_start_timer(&self->final_timer, timeout,
7676 irlap_final_timer_expired);
7777 }
7878
7979 void irlap_start_wd_timer(struct irlap_cb *self, int timeout)
8080 {
81− irda_start_timer(&self->wd_timer, timeout, (void *) self,
81+ irda_start_timer(&self->wd_timer, timeout,
8282 irlap_wd_timer_expired);
8383 }
8484
8585 void irlap_start_backoff_timer(struct irlap_cb *self, int timeout)
8686 {
87− irda_start_timer(&self->backoff_timer, timeout, (void *) self,
87+ irda_start_timer(&self->backoff_timer, timeout,
8888 irlap_backoff_timer_expired);
8989 }
9090
9191 void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout)
9292 {
9393 irda_start_timer(&self->media_busy_timer, timeout,
94− (void *) self, irlap_media_busy_expired);
94+ irlap_media_busy_expired);
9595 }
9696
9797 void irlap_stop_mbusy_timer(struct irlap_cb *self)
@@ -110,19 +110,19 @@ void irlap_stop_mbusy_timer(struct irlap_cb *self) · 12 unmodified lines
110110
111111 void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout)
112112 {
113− irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
113+ irda_start_timer(&self->watchdog_timer, timeout,
114114 irlmp_watchdog_timer_expired);
115115 }
116116
117117 void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout)
118118 {
119− irda_start_timer(&self->discovery_timer, timeout, (void *) self,
119+ irda_start_timer(&self->discovery_timer, timeout,
120120 irlmp_discovery_timer_expired);
121121 }
122122
123123 void irlmp_start_idle_timer(struct lap_cb *self, int timeout)
124124 {
125− irda_start_timer(&self->idle_timer, timeout, (void *) self,
125+ irda_start_timer(&self->idle_timer, timeout,
126126 irlmp_idle_timer_expired);
127127 }
128128
@@ -138,9 +138,9 @@ void irlmp_stop_idle_timer(struct lap_cb *self) · 9 unmodified lines
138138 * IrLAP slot timer has expired
139139 *
140140 */
141−static void irlap_slot_timer_expired(void *data)
141+static void irlap_slot_timer_expired(struct timer_list *t)
142142 {
143− struct irlap_cb *self = (struct irlap_cb *) data;
143+ struct irlap_cb *self = from_timer(self, t, slot_timer);
144144
145145 IRDA_ASSERT(self != NULL, return;);
146146 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -154,9 +154,9 @@ static void irlap_slot_timer_expired(void *data) · 7 unmodified lines
154154 * IrLAP query timer has expired
155155 *
156156 */
157−static void irlap_query_timer_expired(void *data)
157+static void irlap_query_timer_expired(struct timer_list *t)
158158 {
159− struct irlap_cb *self = (struct irlap_cb *) data;
159+ struct irlap_cb *self = from_timer(self, t, query_timer);
160160
161161 IRDA_ASSERT(self != NULL, return;);
162162 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -170,9 +170,9 @@ static void irlap_query_timer_expired(void *data) · 7 unmodified lines
170170 *
171171 *
172172 */
173−static void irlap_final_timer_expired(void *data)
173+static void irlap_final_timer_expired(struct timer_list *t)
174174 {
175− struct irlap_cb *self = (struct irlap_cb *) data;
175+ struct irlap_cb *self = from_timer(self, t, final_timer);
176176
177177 IRDA_ASSERT(self != NULL, return;);
178178 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -186,9 +186,9 @@ static void irlap_final_timer_expired(void *data) · 7 unmodified lines
186186 *
187187 *
188188 */
189−static void irlap_wd_timer_expired(void *data)
189+static void irlap_wd_timer_expired(struct timer_list *t)
190190 {
191− struct irlap_cb *self = (struct irlap_cb *) data;
191+ struct irlap_cb *self = from_timer(self, t, wd_timer);
192192
193193 IRDA_ASSERT(self != NULL, return;);
194194 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -202,9 +202,9 @@ static void irlap_wd_timer_expired(void *data) · 7 unmodified lines
202202 *
203203 *
204204 */
205−static void irlap_backoff_timer_expired(void *data)
205+static void irlap_backoff_timer_expired(struct timer_list *t)
206206 {
207− struct irlap_cb *self = (struct irlap_cb *) data;
207+ struct irlap_cb *self = from_timer(self, t, backoff_timer);
208208
209209 IRDA_ASSERT(self != NULL, return;);
210210 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
@@ -218,9 +218,9 @@ static void irlap_backoff_timer_expired(void *data) · 7 unmodified lines
218218 *
219219 *
220220 */
221−static void irlap_media_busy_expired(void *data)
221+static void irlap_media_busy_expired(struct timer_list *t)
222222 {
223− struct irlap_cb *self = (struct irlap_cb *) data;
223+ struct irlap_cb *self = from_timer(self, t, media_busy_timer);
224224
225225 IRDA_ASSERT(self != NULL, return;);
226226
drivers/staging/ks7010/ks_wlan_net.c+12−3
@@ -114,7 +114,7 @@ int ks_wlan_update_phy_information(struct ks_wlan_private *priv) · 113 unmodified lines
114114 }
115115
116116 static
117−void ks_wlan_update_phyinfo_timeout(unsigned long ptr)
117+void ks_wlan_update_phyinfo_timeout(struct timer_list *unused)
118118 {
119119 DPRINTK(4, "in_interrupt = %ld\n", in_interrupt());
120120 atomic_set(&update_phyinfo, 0);
@@ -473,13 +473,16 @@ static int ks_wlan_set_rate(struct net_device *dev, · 352 unmodified lines
473473 priv->reg.rate_set.body[3] =
474474 TX_RATE_11M;
475475 i++;
476+ /* fall through */
476477 case 5500000:
477478 priv->reg.rate_set.body[2] = TX_RATE_5M;
478479 i++;
480+ /* fall through */
479481 case 2000000:
480482 priv->reg.rate_set.body[1] =
481483 TX_RATE_2M | BASIC_RATE;
482484 i++;
485+ /* fall through */
483486 case 1000000:
484487 priv->reg.rate_set.body[0] =
485488 TX_RATE_1M | BASIC_RATE;
@@ -535,14 +538,17 @@ static int ks_wlan_set_rate(struct net_device *dev, · 49 unmodified lines
535538 priv->reg.rate_set.body[11] =
536539 TX_RATE_54M;
537540 i++;
541+ /* fall through */
538542 case 48000000:
539543 priv->reg.rate_set.body[10] =
540544 TX_RATE_48M;
541545 i++;
546+ /* fall through */
542547 case 36000000:
543548 priv->reg.rate_set.body[9] =
544549 TX_RATE_36M;
545550 i++;
551+ /* fall through */
546552 case 24000000:
547553 case 18000000:
548554 case 12000000:
@@ -619,14 +625,17 @@ static int ks_wlan_set_rate(struct net_device *dev, · 70 unmodified lines
619625 TX_RATE_6M | BASIC_RATE;
620626 i++;
621627 }
628+ /* fall through */
622629 case 5500000:
623630 priv->reg.rate_set.body[2] =
624631 TX_RATE_5M | BASIC_RATE;
625632 i++;
633+ /* fall through */
626634 case 2000000:
627635 priv->reg.rate_set.body[1] =
628636 TX_RATE_2M | BASIC_RATE;
629637 i++;
638+ /* fall through */
630639 case 1000000:
631640 priv->reg.rate_set.body[0] =
632641 TX_RATE_1M | BASIC_RATE;
@@ -2010,6 +2019,7 @@ static int ks_wlan_set_mlme(struct net_device *dev, · 1377 unmodified lines
20102019 case IW_MLME_DEAUTH:
20112020 if (mlme->reason_code == WLAN_REASON_MIC_FAILURE)
20122021 return 0;
2022+ /* fall through */
20132023 case IW_MLME_DISASSOC:
20142024 mode = 1;
20152025 return ks_wlan_set_stop_request(dev, NULL, &mode, NULL);
@@ -2941,8 +2951,7 @@ int ks_wlan_net_start(struct net_device *dev) · 925 unmodified lines
29412951
29422952 /* phy information update timer */
29432953 atomic_set(&update_phyinfo, 0);
2944− setup_timer(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout,
2945− (unsigned long)priv);
2954+ timer_setup(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout, 0);
29462955
29472956 /* dummy address set */
29482957 memcpy(priv->eth_addr, dummy_addr, ETH_ALEN);
drivers/staging/lustre/include/linux/libcfs/curproc.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /* GPL HEADER START
23 *
34 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_time.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/libcfs_workitem.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/linux/linux-cpu.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/lnet/api.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/lnet/lib-lnet.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/include/linux/lnet/lib-types.h+14−15
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
@@ -160,9 +161,9 @@ struct lnet_libmd { · 156 unmodified lines
160161 } md_iov;
161162 };
162163
163−#define LNET_MD_FLAG_ZOMBIE (1 << 0)
164−#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1)
165−#define LNET_MD_FLAG_ABORTED (1 << 2)
164+#define LNET_MD_FLAG_ZOMBIE BIT(0)
165+#define LNET_MD_FLAG_AUTO_UNLINK BIT(1)
166+#define LNET_MD_FLAG_ABORTED BIT(2)
166167
167168 struct lnet_test_peer {
168169 /* info about peers we are trying to fail */
@@ -287,9 +288,9 @@ struct lnet_ni { · 118 unmodified lines
287288 * of old LNet, so there shouldn't be any compatibility issue
288289 */
289290 #define LNET_PING_FEAT_INVAL (0) /* no feature */
290−#define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
291−#define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
292−#define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
291+#define LNET_PING_FEAT_BASE BIT(0) /* just a ping */
292+#define LNET_PING_FEAT_NI_STATUS BIT(1) /* return NI status */
293+#define LNET_PING_FEAT_RTE_DISABLED BIT(2) /* Routing enabled */
293294
294295 #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \
295296 LNET_PING_FEAT_NI_STATUS)
@@ -440,23 +441,21 @@ struct lnet_rtrbuf { · 144 unmodified lines
440441
441442 enum lnet_match_flags {
442443 /* Didn't match anything */
443− LNET_MATCHMD_NONE = (1 << 0),
444+ LNET_MATCHMD_NONE = BIT(0),
444445 /* Matched OK */
445− LNET_MATCHMD_OK = (1 << 1),
446+ LNET_MATCHMD_OK = BIT(1),
446447 /* Must be discarded */
447− LNET_MATCHMD_DROP = (1 << 2),
448+ LNET_MATCHMD_DROP = BIT(2),
448449 /* match and buffer is exhausted */
449− LNET_MATCHMD_EXHAUSTED = (1 << 3),
450+ LNET_MATCHMD_EXHAUSTED = BIT(3),
450451 /* match or drop */
451452 LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
452453 };
453454
454455 /* Options for lnet_portal::ptl_options */
455−#define LNET_PTL_LAZY (1 << 0)
456−#define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */
457−#define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match,
458− * request portal
459− */
456+#define LNET_PTL_LAZY BIT(0)
457+#define LNET_PTL_MATCH_UNIQUE BIT(1) /* unique match, for RDMA */
458+#define LNET_PTL_MATCH_WILDCARD BIT(2) /* wildcard match, request portal */
460459
461460 /* parameter for matching operations (GET, PUT) */
462461 struct lnet_match_info {
drivers/staging/lustre/include/linux/lnet/socklnd.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c+5−12
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
@@ -176,12 +177,9 @@ struct ksock_peer * · 172 unmodified lines
176177 ksocknal_find_peer_locked(struct lnet_ni *ni, struct lnet_process_id id)
177178 {
178179 struct list_head *peer_list = ksocknal_nid2peerlist(id.nid);
179− struct list_head *tmp;
180180 struct ksock_peer *peer;
181181
182− list_for_each(tmp, peer_list) {
183− peer = list_entry(tmp, struct ksock_peer, ksnp_list);
184−
182+ list_for_each_entry(peer, peer_list, ksnp_list) {
185183 LASSERT(!peer->ksnp_closing);
186184
187185 if (peer->ksnp_ni != ni)
@@ -453,7 +451,6 @@ int · 265 unmodified lines
453451 ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ipaddr,
454452 int port)
455453 {
456− struct list_head *tmp;
457454 struct ksock_peer *peer;
458455 struct ksock_peer *peer2;
459456 struct ksock_route *route;
@@ -491,9 +488,7 @@ ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ipaddr, · 31 unmodified lines
491488 }
492489
493490 route2 = NULL;
494− list_for_each(tmp, &peer->ksnp_routes) {
495− route2 = list_entry(tmp, struct ksock_route, ksnr_list);
496−
491+ list_for_each_entry(route2, &peer->ksnp_routes, ksnr_list) {
497492 if (route2->ksnr_ipaddr == ipaddr)
498493 break;
499494
@@ -1854,12 +1849,10 @@ ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when) · 1354 unmodified lines
18541849
18551850 peer = ksocknal_find_peer_locked(ni, id);
18561851 if (peer) {
1857− struct list_head *tmp;
18581852 struct ksock_conn *conn;
18591853 int bufnob;
18601854
1861− list_for_each(tmp, &peer->ksnp_conns) {
1862− conn = list_entry(tmp, struct ksock_conn, ksnc_list);
1855+ list_for_each_entry(conn, &peer->ksnp_conns, ksnc_list) {
18631856 bufnob = conn->ksnc_sock->sk->sk_wmem_queued;
18641857
18651858 if (bufnob < conn->ksnc_tx_bufnob) {
@@ -2316,7 +2309,7 @@ ksocknal_base_shutdown(void) · 450 unmodified lines
23162309 switch (ksocknal_data.ksnd_init) {
23172310 default:
23182311 LASSERT(0);
2319−
2312+ /* fall through */
23202313 case SOCKNAL_INIT_ALL:
23212314 case SOCKNAL_INIT_DATA:
23222315 LASSERT(ksocknal_data.ksnd_peers);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
34 *
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
34 *
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
34 *
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
34 *
drivers/staging/lustre/lnet/libcfs/debug.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/fail.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/hash.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/libcfs_lock.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/libcfs_mem.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/libcfs_string.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * GPL HEADER START
34 *
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c+1−0
@@ -1,3 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /* GPL HEADER START
23 *

1 more lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-curproc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-mem.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-module.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/module.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/prng.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/tracefile.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/tracefile.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/libcfs/workitem.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/acceptor.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/api-ni.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/config.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-eq.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-md.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-me.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-move.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-msg.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-ptl.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lib-socket.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/lo.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/module.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/net_fault.c+2−0

This diff is large: its 13 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/nidstrings.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/peer.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/router.c+3−7

This diff is large: its 40 lines aren’t shown here.

drivers/staging/lustre/lnet/lnet/router_proc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/brw_test.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/conctl.c+2−0

This diff is large: its 13 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/conrpc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/conrpc.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/console.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/console.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/framework.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/module.c+5−1

This diff is large: its 28 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/ping_test.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/rpc.c+10−4

This diff is large: its 73 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/rpc.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/selftest.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/timer.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lnet/selftest/timer.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fid/fid_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fid/fid_lib.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fid/fid_request.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/fid/lproc_fid.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fld/fld_cache.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fld/fld_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/fld/fld_request.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/fld/lproc_fld.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/cl_object.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/interval_tree.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/llog_swab.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lprocfs_status.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lu_object.h+2−3

This diff is large: its 23 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lu_ref.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_acl.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_compat.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_debug.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_disk.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_dlm.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_dlm_flags.h+5−2

This diff is large: its 25 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_errno.h+17−34

This diff is large: its 105 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_export.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_fid.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_fld.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_ha.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_handles.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_import.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_intent.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_kernelcomm.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_lib.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_linkea.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_lmv.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_log.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_mdc.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_mds.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_net.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_nrs.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_obdo.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_patchless_compat.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_req_layout.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_sec.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/lustre_swab.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/obd.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/obd_cksum.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/obd_class.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/obd_support.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/include/seq_range.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/interval_tree.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/l_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_extent.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_flock.c+47−168

This diff is large: its 372 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_internal.h+2−1

This diff is large: its 14 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_lib.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_lock.c+23−11

This diff is large: its 98 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c+5−2

This diff is large: its 25 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_plain.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_pool.c+5−2

This diff is large: its 25 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_request.c+28−16

This diff is large: its 134 lines aren’t shown here.

drivers/staging/lustre/lustre/ldlm/ldlm_resource.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/dcache.c+7−3

This diff is large: its 35 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/dir.c+12−9

This diff is large: its 60 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/file.c+9−5

This diff is large: its 46 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/glimpse.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/lcommon_cl.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/lcommon_misc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/llite_internal.h+12−7

This diff is large: its 72 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/llite_lib.c+20−10

This diff is large: its 97 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/llite_mmap.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/llite_nfs.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/lproc_llite.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/namei.c+14−6

This diff is large: its 66 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/range_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/range_lock.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/rw.c+12−6

This diff is large: its 57 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/rw26.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/statahead.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/super25.c+3−1

This diff is large: its 15 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/symlink.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_dev.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_io.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/vvp_page.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/xattr.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/xattr_cache.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/lustre/lustre/llite/xattr_security.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lmv/lmv_fld.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lmv/lmv_intent.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lmv/lmv_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lmv/lmv_obd.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lmv/lproc_lmv.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_cl_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_dev.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_ea.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_io.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_merge.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_obd.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_offset.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_pack.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_page.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_pool.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lov_request.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lovsub_dev.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lovsub_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lovsub_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lovsub_page.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/lov/lproc_lov.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/lproc_mdc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/mdc_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/mdc_lib.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/mdc_locks.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/mdc_reint.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mdc/mdc_request.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mgc/lproc_mgc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mgc/mgc_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/mgc/mgc_request.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/cl_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/cl_io.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/cl_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/cl_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/cl_page.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/class_obd.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/debug.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/genops.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/kernelcomm.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/linkea.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/linux/linux-module.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/llog.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/llog_cat.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/llog_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/llog_obd.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/llog_swab.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lprocfs_status.c+5−0

This diff is large: its 22 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lu_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lu_ref.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lustre_handles.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/lustre_peer.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/obd_config.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/obd_mount.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/obdo.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/statfs_pack.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdclass/uuid.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdecho/echo_client.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/obdecho/echo_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/lproc_osc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_cache.c+2−0

This diff is large: its 13 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_cl_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_dev.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_io.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_lock.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_object.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_page.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_quota.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/osc/osc_request.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/client.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/connection.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/errno.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/events.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/import.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/layout.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/llog_client.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/llog_net.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/niobuf.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/nrs.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/pack_generic.c+4−3

This diff is large: its 32 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/pers.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/pinger.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/recover.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec.c+2−1

This diff is large: its 14 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_config.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_gc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_null.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/sec_plain.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/service.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/lustre/lustre/ptlrpc/wiretest.c+1−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c+19−8

This diff is large: its 138 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c+4−4

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/bcm2048/radio-bcm2048.c+30−30

This diff is large: its 88 lines aren’t shown here.

drivers/staging/netlogic/xlr_net.c+38−44

This diff is large: its 120 lines aren’t shown here.

drivers/staging/pi433/Documentation/pi433.txt+12−12

This diff is large: its 102 lines aren’t shown here.

drivers/staging/pi433/pi433_if.c+25−42

This diff is large: its 225 lines aren’t shown here.

drivers/staging/pi433/rf69.c+132−104

This diff is large: its 489 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_ap.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_cmd.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_efuse.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_led.c+3−4

This diff is large: its 22 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_mlme.c+26−23

This diff is large: its 148 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_mlme_ext.c+54−35

This diff is large: its 278 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_pwrctrl.c+18−17

This diff is large: its 131 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_recv.c+85−59

This diff is large: its 369 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_security.c+1−1

This diff is large: its 6 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_sta_mgt.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtl8188eu/core/rtw_xmit.c+32−32

This diff is large: its 210 lines aren’t shown here.

drivers/staging/rtl8188eu/hal/odm.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8188eu/hal/odm_HWConfig.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtl8188eu/hal/phy.c+7−8

This diff is large: its 47 lines aren’t shown here.

drivers/staging/rtl8188eu/hal/usb_halinit.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h+22−11

This diff is large: its 66 lines aren’t shown here.

drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h+14−14

This diff is large: its 35 lines aren’t shown here.

drivers/staging/rtl8188eu/include/basic_types.h+8−6

This diff is large: its 38 lines aren’t shown here.

drivers/staging/rtl8188eu/include/drv_types.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8188eu/include/hal_intf.h+4−2

This diff is large: its 14 lines aren’t shown here.

drivers/staging/rtl8188eu/include/ieee80211.h+59−55

This diff is large: its 195 lines aren’t shown here.

drivers/staging/rtl8188eu/include/odm.h+29−17

This diff is large: its 139 lines aren’t shown here.

drivers/staging/rtl8188eu/include/osdep_intf.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8188eu/include/pwrseq.h+22−22

This diff is large: its 51 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtl8188e_hal.h+18−11

This diff is large: its 102 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtl8188e_spec.h+85−72

This diff is large: its 287 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_cmd.h+113−109

This diff is large: its 284 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_debug.h+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_eeprom.h+6−3

This diff is large: its 30 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_event.h+20−20

This diff is large: its 63 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_led.h+4−3

This diff is large: its 28 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_mlme.h+25−19

This diff is large: its 80 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_mlme_ext.h+21−12

This diff is large: its 90 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h+13−6

This diff is large: its 58 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_pwrctrl.h+13−9

This diff is large: its 51 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_qos.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_recv.h+42−40

This diff is large: its 124 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_rf.h+4−2

This diff is large: its 20 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_security.h+18−9

This diff is large: its 58 lines aren’t shown here.

drivers/staging/rtl8188eu/include/rtw_xmit.h+8−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/rtl8188eu/include/sta_info.h+8−4

This diff is large: its 34 lines aren’t shown here.

drivers/staging/rtl8188eu/include/wifi.h+14−11

This diff is large: its 48 lines aren’t shown here.

drivers/staging/rtl8188eu/include/wlan_bssdef.h+14−8

This diff is large: its 71 lines aren’t shown here.

drivers/staging/rtl8188eu/os_dep/mlme_linux.c+7−12

This diff is large: its 39 lines aren’t shown here.

drivers/staging/rtl8188eu/os_dep/mon.c+5−29

This diff is large: its 56 lines aren’t shown here.

drivers/staging/rtl8188eu/os_dep/recv_linux.c+2−3

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192e/dot11d.c+6−2

This diff is large: its 19 lines aren’t shown here.

drivers/staging/rtl8192e/rtl8192e/rtl_core.c+11−14

This diff is large: its 74 lines aren’t shown here.

drivers/staging/rtl8192e/rtl8192e/rtl_core.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192e/rtl8192e/rtl_dm.c+5−6

This diff is large: its 33 lines aren’t shown here.

drivers/staging/rtl8192e/rtl8192e/rtl_pm.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192e/rtl819x_BAProc.c+9−6

This diff is large: its 38 lines aren’t shown here.

drivers/staging/rtl8192e/rtl819x_TSProc.c+23−33

This diff is large: its 98 lines aren’t shown here.

drivers/staging/rtl8192e/rtllib.h+3−3

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rtl8192e/rtllib_softmac.c+11−12

This diff is large: its 55 lines aren’t shown here.

drivers/staging/rtl8192e/rtllib_wx.c+1−2

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211.h+58−60

This diff is large: its 317 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_module.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c+13−14

This diff is large: its 42 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c+4−11

This diff is large: its 29 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c+8−8

This diff is large: its 53 lines aren’t shown here.

drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c+22−24

This diff is large: its 88 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_core.c+10−10

This diff is large: its 74 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_dm.c+4−5

This diff is large: its 24 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_dm.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_wx.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8192u/r8192U_wx.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8712/hal_init.c+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8712/mlme_linux.c+24−24

This diff is large: its 92 lines aren’t shown here.

drivers/staging/rtl8712/os_intfs.c+4−4

This diff is large: its 25 lines aren’t shown here.

drivers/staging/rtl8712/rtl8712_cmd.c+2−2

This diff is large: its 14 lines aren’t shown here.

drivers/staging/rtl8712/rtl8712_event.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/rtl8712/rtl8712_recv.c+3−3

This diff is large: its 22 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_cmd.c+2−1

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_ioctl_set.c+2−2

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_mlme.c+2−2

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_pwrctrl.c+4−4

This diff is large: its 23 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_security.c+3−2

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rtl8712/rtl871x_security.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8712/usb_intf.c+2−1

This diff is large: its 12 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_ap.c+4−6

This diff is large: its 33 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_btcoex.c+2−2

This diff is large: its 14 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_cmd.c+72−72

This diff is large: its 472 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_debug.c+5−3

This diff is large: its 22 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_ieee80211.c+3−3

This diff is large: its 13 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_ioctl_set.c+0−4

This diff is large: its 15 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_mlme.c+11−10

This diff is large: its 77 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c+75−65

This diff is large: its 525 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c+16−18

This diff is large: its 94 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_recv.c+16−17

This diff is large: its 126 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_rf.c+3−4

This diff is large: its 31 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_security.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_sta_mgt.c+5−5

This diff is large: its 35 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_wlan_util.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtl8723bs/core/rtw_xmit.c+1−4

This diff is large: its 19 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c+4−5

This diff is large: its 44 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c+3−4

This diff is large: its 35 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/hal_btcoex.c+2−9

This diff is large: its 26 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/hal_com.c+5−5

This diff is large: its 52 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/hal_com_phycfg.c+45−24

This diff is large: its 143 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/odm_CfoTracking.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/odm_DIG.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/odm_HWConfig.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/sdio_halinit.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtl8723bs/hal/sdio_ops.c+5−5

This diff is large: its 45 lines aren’t shown here.

drivers/staging/rtl8723bs/include/drv_types.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/rtl8723bs/include/osdep_service.h+2−4

This diff is large: its 20 lines aren’t shown here.

drivers/staging/rtl8723bs/include/osdep_service_linux.h+1−12

This diff is large: its 27 lines aren’t shown here.

drivers/staging/rtl8723bs/include/rtw_mlme.h+5−5

This diff is large: its 25 lines aren’t shown here.

drivers/staging/rtl8723bs/include/rtw_mlme_ext.h+5−5

This diff is large: its 24 lines aren’t shown here.

drivers/staging/rtl8723bs/include/rtw_pwrctrl.h+2−1

This diff is large: its 17 lines aren’t shown here.

drivers/staging/rtl8723bs/include/rtw_recv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+7−9

This diff is large: its 51 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/ioctl_linux.c+17−28

This diff is large: its 167 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/mlme_linux.c+32−30

This diff is large: its 137 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/os_intfs.c+104−139

This diff is large: its 807 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/osdep_service.c+6−18

This diff is large: its 51 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/recv_linux.c+2−3

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtl8723bs/os_dep/rtw_proc.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/staging/rtlwifi/base.c+28−30

This diff is large: its 151 lines aren’t shown here.

drivers/staging/rtlwifi/base.h+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtlwifi/core.c+18−54

This diff is large: its 149 lines aren’t shown here.

drivers/staging/rtlwifi/core.h+0−4

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtlwifi/debug.c+18−18

This diff is large: its 78 lines aren’t shown here.

drivers/staging/rtlwifi/efuse.c+2−3

This diff is large: its 15 lines aren’t shown here.

drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c+2−0

This diff is large: its 11 lines aren’t shown here.

drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c+14−36

This diff is large: its 162 lines aren’t shown here.

drivers/staging/rtlwifi/halmac/rtl_halmac.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtlwifi/pci.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/halphyrf_ce.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm.c+4−4

This diff is large: its 36 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm_adaptivity.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm_debug.c+6−6

This diff is large: its 48 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm_dig.c+13−11

This diff is large: its 87 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm_interface.c+0−23

This diff is large: its 30 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/phydm_interface.h+0−11

This diff is large: its 18 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_bb.c+4−6

This diff is large: its 59 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_mac.c+2−2

This diff is large: its 25 lines aren’t shown here.

drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_rf.c+5−8

This diff is large: its 72 lines aren’t shown here.

drivers/staging/rtlwifi/ps.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtlwifi/rc.c+7−9

This diff is large: its 52 lines aren’t shown here.

drivers/staging/rtlwifi/rtl8822be/fw.c+5−4

This diff is large: its 39 lines aren’t shown here.

drivers/staging/rtlwifi/rtl8822be/led.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/rtlwifi/rtl8822be/phy.c+12−11

This diff is large: its 75 lines aren’t shown here.

drivers/staging/rtlwifi/rtl8822be/trx.c+12−12

This diff is large: its 59 lines aren’t shown here.

drivers/staging/rts5208/sd.c+0−6

This diff is large: its 13 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_chip.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_dvi.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_dvi.h+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_power.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_power.h+3−4

This diff is large: its 24 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_sii164.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/sm750fb/ddk750_sii164.h+2−2

This diff is large: its 15 lines aren’t shown here.

drivers/staging/sm750fb/sm750_cursor.c+0−4

This diff is large: its 25 lines aren’t shown here.

drivers/staging/speakup/buffers.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/speakup/main.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/speakup/speakup_acntsa.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_apollo.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_audptr.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_bns.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_decext.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_dectlk.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_dummy.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_ltlk.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_spkout.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/speakup_txprt.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/speakup/spk_ttyio.c+5−5

This diff is large: its 32 lines aren’t shown here.

drivers/staging/typec/Kconfig+0−10

This diff is large: its 23 lines aren’t shown here.

drivers/staging/typec/Makefile+0−2

This diff is large: its 4 lines aren’t shown here.

drivers/staging/typec/TODO+0−10

This diff is large: its 14 lines aren’t shown here.

drivers/staging/typec/fusb302/TODO+0−10

This diff is large: its 11 lines aren’t shown here.

drivers/staging/typec/tcpci.c+3−2

This diff is large: its 22 lines aren’t shown here.

drivers/staging/unisys/MAINTAINERS+1−1

This diff is large: its 7 lines aren’t shown here.

drivers/staging/unisys/include/iochannel.h+4−5

This diff is large: its 23 lines aren’t shown here.

drivers/staging/unisys/include/visorbus.h+67−92

This diff is large: its 202 lines aren’t shown here.

drivers/staging/unisys/include/visorchannel.hrenamed from drivers/staging/unisys/include/channel.h+4−8

This diff is large: its 30 lines aren’t shown here.

drivers/staging/unisys/visorbus/controlvmchannel.h+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/unisys/visorbus/vbuschannel.h+5−7

This diff is large: its 40 lines aren’t shown here.

drivers/staging/unisys/visorbus/visorbus_main.c+126−145

This diff is large: its 732 lines aren’t shown here.

drivers/staging/unisys/visorbus/visorbus_private.h+3−5

This diff is large: its 29 lines aren’t shown here.

drivers/staging/unisys/visorbus/visorchannel.c+21−60

This diff is large: its 253 lines aren’t shown here.

drivers/staging/unisys/visorbus/visorchipset.c+69−229

This diff is large: its 1010 lines aren’t shown here.

drivers/staging/unisys/visorhba/visorhba_main.c+7−5

This diff is large: its 41 lines aren’t shown here.

drivers/staging/unisys/visorinput/visorinput.c+4−2

This diff is large: its 20 lines aren’t shown here.

drivers/staging/unisys/visornic/visornic_main.c+6−4

This diff is large: its 45 lines aren’t shown here.

drivers/staging/vboxvideo/vbox_drv.h+4−4

This diff is large: its 22 lines aren’t shown here.

drivers/staging/vboxvideo/vbox_irq.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/vboxvideo/vbox_mode.c+18−8

This diff is large: its 41 lines aren’t shown here.

drivers/staging/vc04_services/Kconfig+0−12

This diff is large: its 19 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c+0−11

This diff is large: its 86 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c+0−11

This diff is large: its 88 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-audio/bcm2835.h+0−2

This diff is large: its 9 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h+12−12

This diff is large: its 57 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchi/connections/connection.h+0−3

This diff is large: its 24 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchi/message_drivers/message.h+0−5

This diff is large: its 40 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchi/vchi.h+1−11

This diff is large: its 82 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchi/vchi_common.h+0−6

This diff is large: its 37 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c+30−27

This diff is large: its 115 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c+7−170

This diff is large: its 280 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h+1−5

This diff is large: its 38 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c+1−12

This diff is large: its 89 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c+0−3

This diff is large: its 24 lines aren’t shown here.

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c+22−25

This diff is large: its 209 lines aren’t shown here.

drivers/staging/vme/devices/Kconfig+0−13

This diff is large: its 17 lines aren’t shown here.

drivers/staging/vme/devices/Makefile+0−3

This diff is large: its 7 lines aren’t shown here.

drivers/staging/vme/devices/vme_pio2.h+0−245

This diff is large: its 246 lines aren’t shown here.

drivers/staging/vme/devices/vme_pio2_cntr.c+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/vme/devices/vme_pio2_core.c+0−493

This diff is large: its 494 lines aren’t shown here.

drivers/staging/vme/devices/vme_pio2_gpio.c+0−220

This diff is large: its 221 lines aren’t shown here.

drivers/staging/vt6655/device_main.c+2−1

This diff is large: its 13 lines aren’t shown here.

drivers/staging/vt6655/key.c+3−1

This diff is large: its 21 lines aren’t shown here.

drivers/staging/vt6656/card.c+2−0

This diff is large: its 14 lines aren’t shown here.

drivers/staging/wilc1000/host_interface.c+25−20

This diff is large: its 131 lines aren’t shown here.

drivers/staging/wilc1000/host_interface.h+5−0

This diff is large: its 14 lines aren’t shown here.

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/staging/wilc1000/wilc_wlan.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/wlan-ng/hfa384x_usb.c+13−16

This diff is large: its 78 lines aren’t shown here.

drivers/staging/wlan-ng/prism2mgmt.c+47−31

This diff is large: its 185 lines aren’t shown here.

drivers/staging/wlan-ng/prism2mgmt.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/wlan-ng/prism2sta.c+3−3

This diff is large: its 21 lines aren’t shown here.

drivers/staging/xgifb/XGI_main_26.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/staging/xgifb/vb_setmode.c+4−3

This diff is large: its 21 lines aren’t shown here.

drivers/usb/typec/Kconfig+14−0

This diff is large: its 21 lines aren’t shown here.

drivers/usb/typec/Makefile+2−0

This diff is large: its 6 lines aren’t shown here.

drivers/usb/typec/fusb302/Kconfigrenamed from drivers/staging/typec/fusb302/Kconfig+0−0

File renamed without changes.

drivers/usb/typec/fusb302/Makefilerenamed from drivers/staging/typec/fusb302/Makefile+0−0

File renamed without changes.

drivers/usb/typec/fusb302/fusb302.crenamed from drivers/staging/typec/fusb302/fusb302.c+2−2

This diff is large: its 14 lines aren’t shown here.

drivers/usb/typec/fusb302/fusb302_reg.hrenamed from drivers/staging/typec/fusb302/fusb302_reg.h+0−0

File renamed without changes.

drivers/usb/typec/tcpm.crenamed from drivers/staging/typec/tcpm.c+5−41

This diff is large: its 91 lines aren’t shown here.

include/linux/hid-sensor-hub.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/linux/iio/common/st_sensors.h+23−12

This diff is large: its 53 lines aren’t shown here.

include/linux/iio/iio.h+29−6

This diff is large: its 74 lines aren’t shown here.

include/linux/iio/trigger.h+13−8

This diff is large: its 62 lines aren’t shown here.

include/linux/usb/pd.hrenamed from drivers/staging/typec/pd.h+5−0

This diff is large: its 12 lines aren’t shown here.

include/linux/usb/pd_bdo.hrenamed from drivers/staging/typec/pd_bdo.h+0−0

File renamed without changes.

include/linux/usb/pd_vdo.hrenamed from drivers/staging/typec/pd_vdo.h+0−0

File renamed without changes.

include/linux/usb/tcpm.hrenamed from drivers/staging/typec/tcpm.h+50−7

This diff is large: its 83 lines aren’t shown here.