On Mon, Jul 11, 2022 at 1:30 PM Shreeya PatelHi Andy,
<shreeya.patel@xxxxxxxxxxxxx> wrote:
From: Zhigang Shi <Zhigang.Shi@xxxxxxxxxx>Submitter's SoB always has to be last among SoBs in the proposed change.
Add initial support for ltrf216a ambient light sensor.
Datasheet: https://gitlab.steamos.cloud/shreeya/iio/-/blob/main/LTRF216A.pdf
Co-developed-by: Shreeya Patel <shreeya.patel@xxxxxxxxxxxxx>
Signed-off-by: Shreeya Patel <shreeya.patel@xxxxxxxxxxxxx>
Signed-off-by: Zhigang Shi <Zhigang.Shi@xxxxxxxxxx>
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
...
+static int ltrf216a_set_power_state(struct ltrf216a_data *data, bool on)Unneeded blank line.
+{
+ struct device *dev = &data->client->dev;
+ int ret;
+
+ if (on) {
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0) {
+ dev_err(dev, "Failed to resume runtime PM: %d\n", ret);
+ return ret;
+ }
+
+ } else {...
+ pm_runtime_mark_last_busy(dev);
+ ret = pm_runtime_put_autosuspend(dev);
+ }
+
+ return ret;
+}
+ ret = regmap_read_poll_timeout(data->regmap, LTRF216A_MAIN_STATUS,THe message is a bit misleading. The loop might be broken by the I/O error.
+ val, val & LTRF216A_ALS_DATA_STATUS,
+ LTRF216A_ALS_READ_DATA_DELAY_US,
+ LTRF216A_ALS_READ_DATA_DELAY_US * 50);
+ if (ret) {
+ dev_err(dev, "Timed out waiting for valid data from LTRF216A_MAIN_STATUS reg: %d\n",
+ ret);
+ return ret;...
+ }
+
+ ret = regmap_bulk_read(data->regmap, addr, buf, sizeof(buf));
+ if (ret < 0) {
+ dev_err(dev, "Error reading measurement data: %d\n", ret);
+ return ret;
+ }
+static const struct regmap_config ltrf216a_regmap_config = {Why do you use regmap locking? What for?
+ .name = LTRF216A_DRV_NAME,
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = LTRF216A_MAX_REG,
+};...
+ data->regmap = devm_regmap_init_i2c(client, <rf216a_regmap_config);return dev_err_probe(...);
+ if (IS_ERR(data->regmap)) {
+ dev_err(&client->dev, "Regmap initialization failed.\n");
+ return PTR_ERR(data->regmap);
+ }...
+ ret = devm_pm_runtime_enable(&client->dev);Ditto.
+ if (ret < 0) {
+ dev_err_probe(&client->dev, ret, "Failed to enable runtime PM\n");
+ return ret;
+ }...
+ ret = ltrf216a_init(indio_dev);Ditto.
+ if (ret) {
+ dev_err_probe(&client->dev, ret, "Failed to enable the sensor\n");
+ return ret;
+ }...
+ if (ret < 0)For all these ' < 0', please explain what positive return value means
there, if any, and why it's being ignored.
...
+static const struct i2c_device_id ltrf216a_id[] = {Please, use the string literal directly since it's kinda an ABI,
+ { LTRF216A_DRV_NAME, 0 },
defining above for potential changes is not a good idea. Also you may
drop the ', 0' part.
+ {}...
+};
+static struct i2c_driver ltrf216a_driver = {Ditto.
+ .driver = {
+ .name = LTRF216A_DRV_NAME,
+ .pm = pm_ptr(<rf216a_pm_ops),
+ .of_match_table = ltrf216a_of_match,
+ },
+ .probe_new = ltrf216a_probe,
+ .id_table = ltrf216a_id,
+};