From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbdAZWfb (ORCPT ); Thu, 26 Jan 2017 17:35:31 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36150 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752106AbdAZWfa (ORCPT ); Thu, 26 Jan 2017 17:35:30 -0500 From: Andrey Smirnov To: linux-kernel@vger.kernel.org Cc: Andrey Smirnov , yurovsky@gmail.com, Shawn Guo , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH 2/4] irqchip: Add IRQCHIP_DECLARE_DRIVER macro Date: Thu, 26 Jan 2017 14:05:02 -0800 Message-Id: <20170126220504.4796-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170126220504.4796-1-andrew.smirnov@gmail.com> References: <20170126220504.4796-1-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add IRQCHIP_DECLARE_DRIVER macro to allow having driver code that both registers irqchip and a platform driver. Based on analogous code of CLK_OF_DECLARE_DRIVER. Cc: yurovsky@gmail.com Cc: Shawn Guo Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier Signed-off-by: Andrey Smirnov --- include/linux/irqchip.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index 89c34b2..611e8cc 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -27,6 +27,22 @@ #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn) /* + * Use this macro when you have a driver that requires two + * initialization routines, one at IRQCHIP_DECLARE, and one at + * platform device probe + */ +#define IRQCHIP_DECLARE_DRIVER(name, compat, fn) \ + static int __init \ + name##_of_irqchip_init_driver(struct device_node *np, \ + struct device_node *parent) \ + { \ + of_node_clear_flag(np, OF_POPULATED); \ + return fn(np, parent); \ + } \ + OF_DECLARE_2(irqchip, name, compat, name##_of_irqchip_init_driver) + + +/* * This macro must be used by the different irqchip drivers to declare * the association between their version and their initialization function. * -- 2.9.3