On Tue, May 20, 2025 at 10:50:04PM +0000, Lothar Rubusch wrote: > Add possibilities to set a threshold for activity sensing. Extend the > interrupt handler to process activity interrupts. Provide functions to set > the activity threshold and to enable/disable activity sensing. Further add > a fake channel for having x, y and z axis anded on the iio channel. > > This is a preparatory patch. Some of the definitions and functions are > supposed to be extended for inactivity later on. ... > + int axis_en, int_en, ret; > + > + ret = regmap_read(data->regmap, ADXL313_REG_ACT_INACT_CTL, &axis_ctrl); > + if (ret) > + return ret; > + /* Check if axis for activity are enabled */ > + if (type == ADXL313_ACTIVITY) > + axis_en = FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl); > + else Probably redundant 'else'. Wouldn't if (!=) return 0; work? > + return 0; > + /* The axis are enabled, now check if specific interrupt is enabled */ > + ret = regmap_read(data->regmap, ADXL313_REG_INT_ENABLE, ®val); > + if (ret) > + return ret; > + int_en = adxl313_act_int_reg[type] & regval; > + > + return axis_en && int_en; With the above these lines become: if (FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl) == 0) return 0; return !!(adxl313_act_int_reg[type] & regval); ... > + ret = regmap_update_bits(data->regmap, > + ADXL313_REG_ACT_INACT_CTL, > + axis_ctrl, > + cmd_en ? 0xff : 0x00); Please, utilize given space. You have a lot of it in each line above. > + if (ret) > + return ret; -- With Best Regards, Andy Shevchenko