Re: [PATCH 2/4] Input: pmic8xxx-keypad - use regmap_field for register access

From: Dmitry Torokhov
Date: Tue Oct 07 2014 - 13:26:16 EST


Hi Ivan,

On Tue, Oct 07, 2014 at 12:50:46PM +0300, Ivan T. Ivanov wrote:
> @@ -527,10 +538,55 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, kp);
>
> + if (rows < info->min_rows)
> + rows = info->min_rows;
> +
> + if (cols < info->min_cols)
> + cols = info->min_cols;
> +
> kp->num_rows = rows;
> kp->num_cols = cols;
> kp->dev = &pdev->dev;
>
> + kp->events = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->events);
> + if (IS_ERR(kp->events))
> + return PTR_ERR(kp->events);
> +
> + kp->scan_rows = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->scan_rows);
> + if (IS_ERR(kp->scan_rows))
> + return PTR_ERR(kp->scan_rows);
> +
> + kp->scan_cols = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->scan_cols);
> + if (IS_ERR(kp->scan_cols))
> + return PTR_ERR(kp->scan_cols);
> +
> + kp->enable = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->enable);
> + if (IS_ERR(kp->enable))
> + return PTR_ERR(kp->enable);
> +
> + kp->read_state = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->read_state);
> + if (IS_ERR(kp->read_state))
> + return PTR_ERR(kp->read_state);
> +
> + kp->dbonce = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->dbonce);
> + if (IS_ERR(kp->dbonce))
> + return PTR_ERR(kp->dbonce);
> +
> + kp->pause = devm_regmap_field_alloc(kp->dev, kp->regmap, info->pause);
> + if (IS_ERR(kp->pause))
> + return PTR_ERR(kp->pause);
> +
> + kp->row_hold = devm_regmap_field_alloc(kp->dev, kp->regmap,
> + info->row_hold);
> + if (IS_ERR(kp->row_hold))
> + return PTR_ERR(kp->row_hold);

Why do we have to allocate all regmap fields separately instead of
embedding them into keypad structure?

Thanks.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/