On Fri, 15 Nov 2024 14:18:44 -0600 David Lechner <dlechner@xxxxxxxxxxxx> wrote: > Add a new driver for a generic PWM trigger for SPI offloads. > > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx> Trivial thing to tidy up mentioned below. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > +static int spi_offload_trigger_pwm_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct spi_offload_trigger_info info = { > + .fwnode = dev_fwnode(dev), > + .ops = &spi_offload_trigger_pwm_ops, > + }; > + struct spi_offload_trigger_pwm_state *st; > + struct pwm_state state; > + int ret; > + > + st = devm_kzalloc(&pdev->dev, sizeof(*st), GFP_KERNEL); use dev. > + if (!st) > + return -ENOMEM; > + > + info.priv = st; > + st->dev = dev; > + > + st->pwm = devm_pwm_get(&pdev->dev, NULL); use dev. > + if (IS_ERR(st->pwm)) > + return dev_err_probe(dev, PTR_ERR(st->pwm), "failed to get PWM\n"); > + > + /* init with duty_cycle = 0, output enabled to ensure trigger off */ > + pwm_init_state(st->pwm, &state); > + state.enabled = true; > + > + ret = pwm_apply_might_sleep(st->pwm, &state); > + if (ret < 0) > + return dev_err_probe(dev, ret, "failed to apply PWM state\n"); > + > + ret = devm_add_action_or_reset(dev, spi_offload_trigger_pwm_release, st->pwm); > + if (ret) > + return ret; > + > + return devm_spi_offload_trigger_register(dev, &info); > +}