Message ID | cover.1539705285.git.leonard.crestez@nxp.com |
---|---|
Headers | show |
Series | Port mxs-dcp to imx6ull and imx6sll | expand |
Hi Leonard, On Tue, Oct 16, 2018 at 12:58 PM Leonard Crestez <leonard.crestez@nxp.com> wrote: > + /* DCP clock is optional, only used on some SOCs */ > + sdcp->dcp_clk = devm_clk_get(dev, "dcp"); > + if (IS_ERR(sdcp->dcp_clk)) { > + if (sdcp->dcp_clk != ERR_PTR(-ENOENT)) > + return PTR_ERR(sdcp->dcp_clk); > + sdcp->dcp_clk = NULL; This dcp_clk assignment to NULL does not seem to be necessary. > + > + ret = clk_prepare_enable(sdcp->dcp_clk); > + if (ret) > + return ret; > > ret = devm_request_irq(dev, dcp_vmi_irq, mxs_dcp_irq, 0, > "dcp-vmi-irq", sdcp); > if (ret) { > dev_err(dev, "Failed to claim DCP VMI IRQ!\n"); In case of subsequent errors you should call clk_disable_unprepare(sdcp->dcp_clk).
On Tue, Oct 16, 2018 at 12:59 PM Leonard Crestez <leonard.crestez@nxp.com> wrote: > > The DCP block on 6ull has no major differences other than requiring > explicit clock enabling. > > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Fabio Estevam <festevam@gmail.com>
On Tue, 2018-10-16 at 13:03 -0300, Fabio Estevam wrote: > > + /* DCP clock is optional, only used on some SOCs */ > > + sdcp->dcp_clk = devm_clk_get(dev, "dcp"); > > + if (IS_ERR(sdcp->dcp_clk)) { > > + if (sdcp->dcp_clk != ERR_PTR(-ENOENT)) > > + return PTR_ERR(sdcp->dcp_clk); > > + sdcp->dcp_clk = NULL; > > This dcp_clk assignment to NULL does not seem to be necessary. The clk API ignores all calls if clk == NULL (which is very nice) but not if IS_ERR(clk). Setting dcp_clk to NULL avoids sprinkling other checks. > > + ret = clk_prepare_enable(sdcp->dcp_clk); > > + if (ret) > > + return ret; > > > > ret = devm_request_irq(dev, dcp_vmi_irq, mxs_dcp_irq, 0, > > "dcp-vmi-irq", sdcp); > > if (ret) { > > dev_err(dev, "Failed to claim DCP VMI IRQ!\n"); > > In case of subsequent errors you should call > clk_disable_unprepare(sdcp->dcp_clk). Yes, will resend. Maybe some day clk consumer will automatically undo pending prepare/enables on release?