From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752245AbcAOCCl (ORCPT ); Thu, 14 Jan 2016 21:02:41 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:45282 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbcAOCCj (ORCPT ); Thu, 14 Jan 2016 21:02:39 -0500 Date: Thu, 14 Jan 2016 18:02:37 -0800 From: Stephen Boyd To: Alexandre Belloni Cc: Nicolas Ferre , Boris Brezillon , Jean-Christophe Plagniol-Villard , Michael Turquette , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Subject: Re: [PATCH v3 04/13] clk: at91: make IRQ optional and register them later Message-ID: <20160115020237.GJ22188@codeaurora.org> References: <1449248628-3486-1-git-send-email-alexandre.belloni@free-electrons.com> <1449248628-3486-5-git-send-email-alexandre.belloni@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1449248628-3486-5-git-send-email-alexandre.belloni@free-electrons.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/04, Alexandre Belloni wrote: > @@ -686,3 +652,45 @@ static void __init of_at91sam9x5_clk_main_setup(struct device_node *np) > } > CLK_OF_DECLARE(at91sam9x5_clk_main, "atmel,at91sam9x5-clk-main", > of_at91sam9x5_clk_main_setup); > + > +static const struct of_device_id atmel_clk_main_dt_ids[] = { > + { .compatible = "atmel,at91rm9200-clk-main-osc" }, > + { .compatible = "atmel,at91sam9x5-clk-main-rc-osc" }, > + { .compatible = "atmel,at91sam9x5-clk-main" }, > + { /* sentinel */ } > +}; > + > +static int __init atmel_clk_main_probe(struct platform_device *pdev) > +{ > + struct of_phandle_args clkspec = { .np = pdev->dev.of_node}; > + struct clk_main *clkmain; > + struct clk_hw *hw; > + int ret; > + > + hw = __clk_get_hw(of_clk_get_from_provider(&clkspec)); > + if (!hw) > + return -ENODEV; > + > + clkmain = to_clk_main(hw); > + clkmain->irq = platform_get_irq(pdev, 0); > + if (!clkmain->irq) > + return 0; Is there any way to get the irq into this probe function without getting a clk pointer and then unwrapping it to get an irq value out of the clk_hw wrapper structure? That's a pretty convoluted design. > + > + init_waitqueue_head(&clkmain->wait); > + irq_set_status_flags(clkmain->irq, IRQ_NOAUTOEN); > + ret = devm_request_irq(&pdev->dev, clkmain->irq, clk_main_irq_handler, > + IRQF_TRIGGER_HIGH, __clk_get_name(hw->clk), > + clkmain); > + if (ret) > + clkmain->irq = 0; > + > + return ret; > +} > + -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project