[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151001103412.1ac2231d@bbrezillon>
Date: Thu, 1 Oct 2015 10:34:12 +0200
From: Boris Brezillon <boris.brezillon@...e-electrons.com>
To: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
Cc: Nicolas Ferre <nicolas.ferre@...el.com>,
Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...eaurora.org>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-clk@...r.kernel.org
Subject: Re: [PATCH 06/16] clk: at91: clk-main: factorize irq handling
Hi Alexandre,
On Wed, 30 Sep 2015 18:10:59 +0200
Alexandre Belloni <alexandre.belloni@...e-electrons.com> wrote:
> The three different irq handlers are doing the same thing, factorize their
> code in a generic irq handler.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
> ---
> drivers/clk/at91/clk-main.c | 43 ++++++++++++++++---------------------------
> 1 file changed, 16 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
> index c1f119748bdc..79a380cd1f4e 100644
> --- a/drivers/clk/at91/clk-main.c
> +++ b/drivers/clk/at91/clk-main.c
> @@ -71,12 +71,21 @@ struct clk_sam9x5_main {
>
> #define to_clk_sam9x5_main(hw) container_of(hw, struct clk_sam9x5_main, hw)
>
> -static irqreturn_t clk_main_osc_irq_handler(int irq, void *dev_id)
> +/* Generic structure */
> +struct clk_main {
> + struct clk_hw hw;
> + struct at91_pmc *pmc;
> + unsigned int irq;
> + wait_queue_head_t wait;
> +};
> +#define to_clk_main(hw) container_of(hw, struct clk_main, hw)
It wasn't clear to me at first glance that this structure was actually
a base struct for the clk_main_rc_osc and clk_sam9x5_main struct.
Maybe you should rename it into struct clk_main_base and then replace
the hw, pmc, irq and fields in the child structures by a base field.
Something like:
struct clk_sam9x5_main {
struct clk_main_base base;
u8 parent;
};
struct clk_main_rc_osc {
struct clk_main_base base;
unsigned long frequency;
unsigned long accuracy;
};
Also, it would avoid any problem if someone decides to change the field
oder in one of those structures.
Best Regards,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists