From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbdEaQHU (ORCPT ); Wed, 31 May 2017 12:07:20 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37864 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751015AbdEaQHQ (ORCPT ); Wed, 31 May 2017 12:07:16 -0400 From: Bartosz Golaszewski To: Thomas Gleixner , Marc Zyngier , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 2/5] irq: generic-chip: provide irq_destroy_generic_chip() Date: Wed, 31 May 2017 18:06:57 +0200 Message-Id: <1496246820-13250-3-git-send-email-brgl@bgdev.pl> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496246820-13250-1-git-send-email-brgl@bgdev.pl> References: <1496246820-13250-1-git-send-email-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Most users of irq_alloc_generic_chip() call irq_setup_generic_chip() too. To simplify the cleanup provide a function that both removes a generic chip and frees its memory. Signed-off-by: Bartosz Golaszewski --- include/linux/irq.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/irq.h b/include/linux/irq.h index cba41a4..a5d298e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -973,6 +973,14 @@ static inline void irq_free_generic_chip(struct irq_chip_generic *gc) kfree(gc); } +static inline void irq_destroy_generic_chip(struct irq_chip_generic *gc, + u32 msk, unsigned int clr, + unsigned int set) +{ + irq_remove_generic_chip(gc, msk, clr, set); + irq_free_generic_chip(gc); +} + static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) { return container_of(d->chip, struct irq_chip_type, chip); -- 2.9.3