Mon, 23 Jun 2014 14:10:05 +0200 от Denis Carikli <[email protected]>:
> Signed-off-by: Denis Carikli <[email protected]>
> ---
...
> @@ -681,6 +695,7 @@ int mc13xxx_common_init(struct device *dev)
> &pdata->regulators, sizeof(pdata->regulators));
> mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
> pdata->leds, sizeof(*pdata->leds));
> + mc13xxx_add_subdevice(mc13xxx, "%s-pwm");
> mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
> pdata->buttons, sizeof(*pdata->buttons));
> if (mc13xxx->flags & MC13XXX_USE_CODEC)
> @@ -692,6 +707,7 @@ int mc13xxx_common_init(struct device *dev)
> } else {
> mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
> mc13xxx_add_subdevice(mc13xxx, "%s-led");
> + mc13xxx_add_subdevice(mc13xxx, "%s-pwm");
> mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
> if (mc13xxx->flags & MC13XXX_USE_CODEC)
> mc13xxx_add_subdevice(mc13xxx, "%s-codec");
What a difference for DT and non-DT?
...
> + /* Actual write to the registers */
> + mc13xxx_lock(mc13xxx);
> +
> + ret = mc13xxx_reg_rmw(mc13xxx, MC134708_PWM,
> + MC134708_PWM_MASK << period_offset,
> + pwm_clkdiv << period_offset);
> + if (ret) {
> + mc13xxx_unlock(mc13xxx);
> + return ret;
> + }
You do not need lock()/unlock() here and in the rest of driver code.
...
> +static struct platform_driver pwm_mc34708_driver = {
> + .driver = {
> + .name = "mc34708-pwm",
> + .of_match_table = of_match_ptr(pwm_mc34708_of_match),
> + },
> + .probe = pwm_mc34708_probe,
> + .remove = pwm_mc34708_remove,
> +};
> +module_platform_driver(pwm_mc34708_driver);
module_platform_driver_probe()
---