Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2684794lqo; Tue, 14 May 2024 06:29:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzXsN0u0MhZhSIQ2SXzQxFaSQGPbB+l6RdLJ7kuX6uMhwPzsS7Viiz3KY/PGbfGvREJm2Y0z+5KYTHl5h0+W7wrTIoX9HTKNF7610AEA== X-Google-Smtp-Source: AGHT+IFV6+D7zCD6USF/51sE4UjkPBi/9oHCPDcg/x8v5iSN2LD1QhgyB20wn9esORFS+0BxJI0u X-Received: by 2002:a17:906:b79a:b0:a59:ccc8:577a with SMTP id a640c23a62f3a-a5a2d66547amr928168766b.47.1715693371271; Tue, 14 May 2024 06:29:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715693371; cv=pass; d=google.com; s=arc-20160816; b=DTeWw/TL09UzbIIdKYdt9O6SAz9c8yMpkt7GF1dypUPU11LUXZzOtuPcJ/XyM/2fGy 29vH1cxudpUJspatqmbfR5Pvz3Oab/JqdIUAco15hS6M7lIV5LTiAaxzRG41xF/+TnXn fONI5mPsjQhwzdRfhQLrLgJxl8AMBN1Y+s/dsHxVU/fQtCQCNXusFrZuUFj80Ne6xktM ILBQpj9KgBuhjsczTgj0GLL4meMSLTNm9w6q/5LflD7tB3acPSrJ58iv5EUaMc9D7uEq wqFR5eMhR8h0654lVSKN0lqab5IgQpq9h8HFnrNvJreT8NQbOfK5yt2meIph6qC0KhsV kK9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=L/GCg7oBLyBLy3rS3NtEVFSb4GXNKsog/8E5IgDXvow=; fh=iQIEIpegfxGHAXzmCmQbfua7u3pb28YTuJpmY/Z0V14=; b=epXlAxQSu3EhL3KbZ4Z1wEaDhE20Cvkk+XjzVVOO7eqjbBcGpCUlm2jJ3i8p8STdyw DyXm4pEWpzbAcD+5IfauxkEq+nzD2lShfKpnRty4Sz3PoVGzYYf8SfIUOlDxuF/f7SdA 0mjvDAYuT4+6KPvVVZNYkv6jq5OihL5guC2hyA7TWJG/bx8Up6hjtOXAmh4W6cIoye0P nXowSbjfdzHepEDolmcnl1y3AIGMz7xtOapFqBNcdqNkDrZqPTIuPpPXQmwNX4p+yOF1 Ta3kb6IWsiPHMxiUl2w16iL1onDB1pkEgqDpg3CZoB4OIo345c/PB+Z4drLz4gzy2bC0 QxOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-178745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21bd6si620462566b.375.2024.05.14.06.29.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 06:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-178745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 076BA1F21D29 for ; Tue, 14 May 2024 13:29:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49B931448C1; Tue, 14 May 2024 13:19:21 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63820144300 for ; Tue, 14 May 2024 13:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692760; cv=none; b=QLkUVCRSA4LUKo/0ukR2I1yW2NyWtgwEd+d3dXI29SnWar0W0w/ahBLSqQKxeERIwVZOa/T4OaqLYOdQ+ikRJKT8//YO3rknWR41jUVvLsxe1vZHDtANoHnCBQ2SI/PjDpjk3ZTZ0VCPgzZ7/yhGX1IZv5HxJic33PIBU7SmAO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692760; c=relaxed/simple; bh=cJiBVNeB/ev5QePxtoR/5J6ogoCMOxKP9w9B7a43nD8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=n0wZPOj+sdjrQ+yoBn29vnUhgIXv5kS6jGduGS/js4rw4mXQXFe1vsIuq/x/rqGMnFcmP6BPMrBbPnfk524tFX/4Pz+X8UBsirXE7hvxn4sOvNDS2TTDSexSo0E9FwUgqL9jh2dIVPxfoBf4vIkem6jhMHWHLv3JzOBORQw3trI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VdxgM4JRSzkXdf for ; Tue, 14 May 2024 21:15:43 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 6573018007E for ; Tue, 14 May 2024 21:19:16 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 14 May 2024 21:19:15 +0800 From: Jinjie Ruan To: , CC: Subject: [PATCH] genirq: Refactor the irq_chip_xxx_parent() Date: Tue, 14 May 2024 21:19:10 +0800 Message-ID: <20240514131910.2614027-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500008.china.huawei.com (7.221.188.139) Refactor the irq_chip_xxx_parent(), which can reduce a few lines of codes, with no functional changes. Signed-off-by: Jinjie Ruan --- kernel/irq/chip.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index dc94e0bf2c94..0e358d9a5d06 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1345,6 +1345,13 @@ int irq_chip_get_parent_state(struct irq_data *data, } EXPORT_SYMBOL_GPL(irq_chip_get_parent_state); +static inline void irq_chip_do_common_parent(void (*chip_action)(struct irq_data *), + struct irq_data *data) +{ + data = data->parent_data; + chip_action(data); +} + /** * irq_chip_enable_parent - Enable the parent interrupt (defaults to unmask if * NULL) @@ -1352,11 +1359,8 @@ EXPORT_SYMBOL_GPL(irq_chip_get_parent_state); */ void irq_chip_enable_parent(struct irq_data *data) { - data = data->parent_data; - if (data->chip->irq_enable) - data->chip->irq_enable(data); - else - data->chip->irq_unmask(data); + irq_chip_do_common_parent(data->chip->irq_enable ? : data->chip->irq_unmask, + data); } EXPORT_SYMBOL_GPL(irq_chip_enable_parent); @@ -1367,11 +1371,8 @@ EXPORT_SYMBOL_GPL(irq_chip_enable_parent); */ void irq_chip_disable_parent(struct irq_data *data) { - data = data->parent_data; - if (data->chip->irq_disable) - data->chip->irq_disable(data); - else - data->chip->irq_mask(data); + irq_chip_do_common_parent(data->chip->irq_disable ? : data->chip->irq_mask, + data); } EXPORT_SYMBOL_GPL(irq_chip_disable_parent); @@ -1381,8 +1382,7 @@ EXPORT_SYMBOL_GPL(irq_chip_disable_parent); */ void irq_chip_ack_parent(struct irq_data *data) { - data = data->parent_data; - data->chip->irq_ack(data); + irq_chip_do_common_parent(data->chip->irq_ack, data); } EXPORT_SYMBOL_GPL(irq_chip_ack_parent); @@ -1392,8 +1392,7 @@ EXPORT_SYMBOL_GPL(irq_chip_ack_parent); */ void irq_chip_mask_parent(struct irq_data *data) { - data = data->parent_data; - data->chip->irq_mask(data); + irq_chip_do_common_parent(data->chip->irq_mask, data); } EXPORT_SYMBOL_GPL(irq_chip_mask_parent); @@ -1403,8 +1402,7 @@ EXPORT_SYMBOL_GPL(irq_chip_mask_parent); */ void irq_chip_mask_ack_parent(struct irq_data *data) { - data = data->parent_data; - data->chip->irq_mask_ack(data); + irq_chip_do_common_parent(data->chip->irq_mask_ack, data); } EXPORT_SYMBOL_GPL(irq_chip_mask_ack_parent); @@ -1414,8 +1412,7 @@ EXPORT_SYMBOL_GPL(irq_chip_mask_ack_parent); */ void irq_chip_unmask_parent(struct irq_data *data) { - data = data->parent_data; - data->chip->irq_unmask(data); + irq_chip_do_common_parent(data->chip->irq_unmask, data); } EXPORT_SYMBOL_GPL(irq_chip_unmask_parent); @@ -1425,8 +1422,7 @@ EXPORT_SYMBOL_GPL(irq_chip_unmask_parent); */ void irq_chip_eoi_parent(struct irq_data *data) { - data = data->parent_data; - data->chip->irq_eoi(data); + irq_chip_do_common_parent(data->chip->irq_eoi, data); } EXPORT_SYMBOL_GPL(irq_chip_eoi_parent); -- 2.34.1