static int pmic8xxx_kp_read_data(struct pmic8xxx_kp *kp, u16 *state, u16 data_reg, int read_rows) { int rc, row; unsigned int val; for (row = 0; row < read_rows; row++) { rc = regmap_read(kp->regmap, data_reg, &val); if (rc) return rc; dev_dbg(kp->dev, "%d = %d\n", row, val); state[row] = pmic8xxx_col_state(kp, val); } return 0; }
static int pmic8xxx_kp_read_data(struct pmic8xxx_kp *kp, u16 *state, u16 data_reg, int read_rows) { int rc, row; u8 new_data[PM8XXX_MAX_ROWS]; rc = pmic8xxx_kp_read(kp, new_data, data_reg, read_rows); if (rc) return rc; for (row = 0; row < kp->pdata->num_rows; row++) { dev_dbg(kp->dev, "new_data[%d] = %d\n", row, new_data[row]); state[row] = pmic8xxx_col_state(kp, new_data[row]); } return rc; }