Hi Lothar, On Fri, Mar 28, 2014 at 09:49:00AM +0100, Lothar Waßmann wrote: > static struct pwm_ops imx_pwm_ops = { > .enable = imx_pwm_enable, > .disable = imx_pwm_disable, > @@ -210,6 +228,7 @@ struct imx_pwm_data { > int (*config)(struct pwm_chip *chip, > struct pwm_device *pwm, int duty_ns, int period_ns); > void (*set_enable)(struct pwm_chip *chip, bool enable); > + unsigned output_polarity:1; > }; > > static struct imx_pwm_data imx_pwm_data_v1 = { > @@ -220,6 +239,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = { > static struct imx_pwm_data imx_pwm_data_v2 = { > .config = imx_pwm_config_v2, > .set_enable = imx_pwm_set_enable_v2, > + .output_polarity = 1, > }; > > static const struct of_device_id imx_pwm_dt_ids[] = { > @@ -272,6 +292,11 @@ static int imx_pwm_probe(struct platform_device *pdev) > return PTR_ERR(imx->mmio_base); > > data = of_id->data; > + if (data->output_polarity) { > + dev_dbg(&pdev->dev, "PWM supports output inversion\n"); > + imx_pwm_ops.set_polarity = imx_pwm_set_polarity; > + }
You shouldn't modify imx_pwm_ops in the probe function, it's not good style and prevents us from making the ops const. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/