Since we have access to the struct device_driver and thus to the ID table, there is no need to supply special parameters to st_sensors_of_name_probe(). Besides that we have a common API to get driver match data, there is no need to do matching separately for OF and ACPI. Taking into consideration above, simplify the ST sensors code.
Showing the changes to include/linux (2 of 11 files). Show all
Unified · Split
| @@ -315,16 +315,6 @@ ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, · 314 unmodified lines | ||
| 315 | 315 | ssize_t st_sensors_sysfs_scale_avail(struct device *dev, |
| 316 | 316 | struct device_attribute *attr, char *buf); |
| 317 | 317 | |
| 318 | −#ifdef CONFIG_OF | |
| 319 | −void st_sensors_of_name_probe(struct device *dev, | |
| 320 | − const struct of_device_id *match, | |
| 321 | − char *name, int len); | |
| 322 | −#else | |
| 323 | −static inline void st_sensors_of_name_probe(struct device *dev, | |
| 324 | − const struct of_device_id *match, | |
| 325 | − char *name, int len) | |
| 326 | −{ | |
| 327 | −} | |
| 328 | −#endif | |
| 318 | +void st_sensors_dev_name_probe(struct device *dev, char *name, int len); | |
| 329 | 319 | |
| 330 | 320 | #endif /* ST_SENSORS_H */ |
| @@ -12,18 +12,8 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include <linux/i2c.h> |
| 14 | 14 | #include <linux/iio/common/st_sensors.h> |
| 15 | −#include <linux/of.h> | |
| 16 | 15 | |
| 17 | 16 | int st_sensors_i2c_configure(struct iio_dev *indio_dev, |
| 18 | 17 | struct i2c_client *client); |
| 19 | 18 | |
| 20 | −#ifdef CONFIG_ACPI | |
| 21 | −int st_sensors_match_acpi_device(struct device *dev); | |
| 22 | −#else | |
| 23 | −static inline int st_sensors_match_acpi_device(struct device *dev) | |
| 24 | −{ | |
| 25 | − return -ENODEV; | |
| 26 | −} | |
| 27 | −#endif | |
| 28 | − | |
| 29 | 19 | #endif /* ST_SENSORS_I2C_H */ |