Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2579302lqt; Mon, 22 Apr 2024 15:19:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUraIyYxMDUxuzNSN7sx0lLGcZisFBv5udVzRSWUVS0RFnGlursGn3J/mMIlEw2Vp87vwvOkr4Ntz3R+kvRt4uY8/xhm4QA03gn1c5C3g== X-Google-Smtp-Source: AGHT+IG5ejRGFz2elZBTsasz3vnn1w0GJG2SF22j+4R6fbE+nR930TJOyutG134BysDtsjMWgRZC X-Received: by 2002:a05:6a20:6f8b:b0:1a7:7cae:24dc with SMTP id gv11-20020a056a206f8b00b001a77cae24dcmr13033103pzb.5.1713824382552; Mon, 22 Apr 2024 15:19:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713824382; cv=pass; d=google.com; s=arc-20160816; b=HlP1q7sECryqsTPWy3j2lwO4yeLLoTcJeTQw5599HWoXM0hyqlZAkxi3xLMHA5LzDc rts/oenqQuUBYgAr4gyXNyg+mQcqE3Js6OiAGNBqLRL4HpJqEmSzN7x+yBUGFYeI5Nhz YLHInPI7vjXJ+L9gw1R4nbfcme11N/KjcOh1CtXNN3cBs6yRL789BlL6bH0idTcrIICd SWxXsH3rd4xHC6xX/73RxppmAdWdklY9FF1N68yVbjUF+tjlO4osfmiiPkAW5s3Ud7dz s+At8XWCogMav5oDC4wx6T1dNl+avAYij9wCz7GR2d5kY5Kr2+WyziIOYu8q7iC+xuHL jGaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=LswEfE44mEwAXWJoZftpskhklhezJOAQtEACpWEeju0=; fh=rKijLG4DfXlRK1T+/U+EFaJaBIsbBRHEESMcclcVC84=; b=a+SSXtRzO9SRgZlwjJOPQUYXSsxbxpHk4/hyWstlyrNcJ/ggpNe7v6JFlajHFBBSZC AEgK45Hbt1DuliOSIGvvuEsKh1hvVHy6khlh5c6EUanRPz1At2gcadkyNlbqB4Yd5Gxy nGeUML1P1EQW7YV6O2ThXj8zLaUyC0H9lSu06uKi6aXPQ/mTYUYsoV5tcsR74KAqq8Ip dxhlYI8b4xg6ASoIm2GmyE4b/dbMHdZ1p4YaYRjVISdrsfElm3/uDN/6BfEh48SEAm05 679R2uOye5tAPBP4BFFxh6ygjHUZrAhq4U2vc+Pf3RMqQrIuzUo94YtE2d/KHfCXIUue 3REw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FdFLDAok; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-154080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g20-20020a631114000000b005f751c16a59si8620585pgl.657.2024.04.22.15.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 15:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FdFLDAok; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-154080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 30AEA28243F for ; Mon, 22 Apr 2024 22:19:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFF7E208A5; Mon, 22 Apr 2024 22:19:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FdFLDAok"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="N2ghb6XS" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 7CE05EAC7; Mon, 22 Apr 2024 22:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713824371; cv=none; b=UUHVDlhxvHobAu9lDrXj46qELyUYkdgSEmYF33KyafDFTH6MHtm5qMy/k01MVm0fLRlv6+SqQRCrUhR3lRxEZCYYrxutiRY9ak3nOKmPaqcUT86yMg5dyQXwd98RUK6PQIzJ7HV4ahUuKLAPBNnJpbJQtR5dsasRekKyD0UIu44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713824371; c=relaxed/simple; bh=ND5tqPbLHiRmqAq3seb/NtLicLiXO1QrqUysWJXwAgc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WY5WTRT2/dxJq2pvITuFlrqnCsCNIRmYAkJGV0mkrESeB4xCRfOtVmtATIlhWM1kQdbc79o2FtFC0/gMBib+nNklaPh2/bWi3tY1XsqBDoQfIkIXAqgoF5ljOO8Zszx3rrKvMkiqueX14Ixhe96i1I6gpufQFKwGFClGurskq6I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FdFLDAok; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=N2ghb6XS; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 22 Apr 2024 22:19:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713824368; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LswEfE44mEwAXWJoZftpskhklhezJOAQtEACpWEeju0=; b=FdFLDAokRv9uZfNHRV7ythB/y9kLqiNQykWHREWyjHBT9s7+wJoqp/1NGXhzoRTeOUGb1e Vt5TikLhFfUoEAJWo3ogtCx0Xr45PR18HVcD0BKyTvb9GF4DdDufai9mpyBERKSHG/FHVH I+pDi335MSvgUPgatEL7XIIx0ktqcneDi3MZTTfu1w4NyuOAnKvwEOa/5D9d0NLVaDbVVj gTqsgXT8rB7NLCjiFzyhsASVttcmKrP91wfDqJO6LSi5vKHxgolbH2HPB//BlV8G3sNsf4 5Q/9m5X6oHttWNqBmiQvyGbS/lDy/m/yr3rD5d8FrFCZtZ2Xq8NCh+OZWHVxpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713824368; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LswEfE44mEwAXWJoZftpskhklhezJOAQtEACpWEeju0=; b=N2ghb6XS85DeGDg/SNer0gj+WYov0ThrPAcuDDfx6E+EuiHCykHL9J1xL/RZ0OY8iafh1F KoH0DBXRyBaxupAg== From: "tip-bot2 for Jinjie Ruan" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq: Simplify the checks for irq_set_percpu_devid_partition() Cc: Jinjie Ruan , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20240417085356.3785381-1-ruanjinjie@huawei.com> References: <20240417085356.3785381-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171382436728.10875.7349999854043503567.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the irq/core branch of tip: Commit-ID: bb58c1baa501e3d695d8e13a5bd955fd00e2e879 Gitweb: https://git.kernel.org/tip/bb58c1baa501e3d695d8e13a5bd955fd00e2e879 Author: Jinjie Ruan AuthorDate: Wed, 17 Apr 2024 16:53:56 +08:00 Committer: Thomas Gleixner CommitterDate: Tue, 23 Apr 2024 00:17:07 +02:00 genirq: Simplify the checks for irq_set_percpu_devid_partition() Since whether desc is NULL or desc->percpu_enabled is true, it returns -EINVAL, check them together, and assign desc->percpu_affinity using a ternary to simplify the code. Signed-off-by: Jinjie Ruan Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240417085356.3785381-1-ruanjinjie@huawei.com --- kernel/irq/irqdesc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 3820931..f0d4b98 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -911,10 +911,7 @@ int irq_set_percpu_devid_partition(unsigned int irq, { struct irq_desc *desc = irq_to_desc(irq); - if (!desc) - return -EINVAL; - - if (desc->percpu_enabled) + if (!desc || desc->percpu_enabled) return -EINVAL; desc->percpu_enabled = kzalloc(sizeof(*desc->percpu_enabled), GFP_KERNEL); @@ -922,10 +919,7 @@ int irq_set_percpu_devid_partition(unsigned int irq, if (!desc->percpu_enabled) return -ENOMEM; - if (affinity) - desc->percpu_affinity = affinity; - else - desc->percpu_affinity = cpu_possible_mask; + desc->percpu_affinity = affinity ? : cpu_possible_mask; irq_set_percpu_devid_flags(irq); return 0;