Message ID | 20231212022749.625238-7-yury.norov@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7469426vqy; Mon, 11 Dec 2023 18:28:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IG26NOD3ARthW8iuU7MtvgtUEFxrGm9FeaPRGhqS9plusKioqcKsDoGVR5pwYX+ggHP+p/T X-Received: by 2002:a05:6830:1107:b0:6d9:f66e:f557 with SMTP id w7-20020a056830110700b006d9f66ef557mr5282749otq.8.1702348108670; Mon, 11 Dec 2023 18:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702348108; cv=none; d=google.com; s=arc-20160816; b=JbPjwmPHHEySVfHePuIFRiQJ/xW6z7X+Q0LP00R3nWQSmeBBq7whWHnjrlm9DUeIfr iGJcpok20NQtjbNbKtbf6jf90Y9RNz7H8Js5RcjbW426fYh7amumhDR+yYUpyNTOSRYU RSzt9m2wBGDmm2pWG2p7mCj1MA8NZS4wfCOEBf8oruGet5yP6tzM5KJGHOO/LVQ47rX8 ykPQp15cKrYMMe8nA+yc1+X60Djh2iEydtJB4YIf4dJO8tNm0VUk1/+kPFpKYriY0Xho yZAlvSab3LWLpAtZ7rgUI78UKl+fKAteKqPyhirASLeU9Qopt/ymY2yUt26A1Us9/P8Q SC+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5Tx1ZYksYJvVzuOD+JQP20UpTW3NnHVR2BOmbC32l24=; fh=Al2+0xeT6Wjhg4WeHOypKwcz5GUD2dpNk0jEOZsJjew=; b=KsuRtzxgdIo4hlJe50uiAFTC8jx57rZOujF7t2Z/qDd7WTX+3Kwjq9HFMMJ2/M3WmE LW6VH0j7VqrJGWYwqMsJWvtsXez8jhfa0ZKmF0PG6XoKlswQx29C7c0F4rEYOvDNI8R9 Qv0it7c2hAMW23xp6n6fLOahtNvR9qWNPEBz/zkI/yhFtHdmdJIPc6Qy3raKhHWAaO/5 /fJTT2WFKW4UE3pYzeX7YSTllulI1d97J/sb5VN2pJ/lo58trV4RfODQmttYonW5bozr WDZvP/dh1rDNoXgXsuFh+Ee6uzfHjXFGyInpqFObQYpuEuBliGGcsp08cZ3QhsE7Hn6j QaLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a8xtZAqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g5-20020a056a00078500b006d0810d9bf3si3440947pfu.129.2023.12.11.18.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 18:28:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a8xtZAqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2A74A8057980; Mon, 11 Dec 2023 18:28:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345697AbjLLC2M (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 21:28:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345688AbjLLC17 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 21:27:59 -0500 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CEA3B5; Mon, 11 Dec 2023 18:28:05 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-5e1a2253045so6489357b3.2; Mon, 11 Dec 2023 18:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702348084; x=1702952884; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Tx1ZYksYJvVzuOD+JQP20UpTW3NnHVR2BOmbC32l24=; b=a8xtZAqnpZmxgaldmGbl8zDfw4wGIe4uHry2UiKo2zru/lOtfdVstM7hB700pxlKYW 3H9Ia6HB7n2jiNIZ9mB2RKeNktz8q/qFk3RxdklUxh2VVT2y7b/VF1CmOlFPxRncWnPH mHJj4OzALSXwXiHojrjyXNZyucPR+I0BTZfzqu+mx6TonaYZy6nryn2P3WA/Qjs6J/Bn sYOCyoXCweuD2oVc1tcP6LcK8ixwdpMswad98wl4m/inTvYQBQKV/c5lpqH1sNWcS2HV ydziDWwQIP440jviJbloUYBEzZr3WW9bEqIbIjoje1Qgch+n4+MzzHKmFTaQYrupfJns tDWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702348084; x=1702952884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Tx1ZYksYJvVzuOD+JQP20UpTW3NnHVR2BOmbC32l24=; b=eaXO6BQrUfnzhHbI9TNw3NjZ9fa+jOcvyvSrcfl7XaoqE5JAvp/ekqPqDf6r7w8akp Pm7bTSJ8t2VGmwdaw2+A+T3VnlwMOch23OvaQ2ffMEYjg3B1SbkZTOsVVQ7xib2sGa5Z l4eWFsVEUreJYymF5Bb1arUK1uRQytsh8xQYqeOW3zBJJwdBsOu6tX7UOWNmYOEYcdSE gb8KG9V9Db3KBnjapl8e9SX/Mz9XodDdFqCRc2eWmbPupsQdPwx6uzcgUndRkETC6tSU 7vtVY5hs0SicVxxdAXWpxuNH9P2NQaIyLfY2X9K49cWCubkDxyV+CaGnW6Nw3W01NZKh g8iA== X-Gm-Message-State: AOJu0YyPOsDtzqPgeWM/1mbCI60hPoU7rpsff9db+KKFjjtY2XGBRsik bqpfyOqDp2yGdn45TgxhqCAY2U8mxLcKaw== X-Received: by 2002:a0d:cc8e:0:b0:5d3:8400:ba9 with SMTP id o136-20020a0dcc8e000000b005d384000ba9mr4160559ywd.48.1702348084007; Mon, 11 Dec 2023 18:28:04 -0800 (PST) Received: from localhost ([2601:344:8301:57f0:38aa:1c88:df05:9b73]) by smtp.gmail.com with ESMTPSA id k7-20020a0dc807000000b0059a34cfa2a5sm3422328ywd.67.2023.12.11.18.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 18:28:03 -0800 (PST) From: Yury Norov <yury.norov@gmail.com> To: linux-kernel@vger.kernel.org, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Yury Norov <yury.norov@gmail.com>, linux-mips@vger.kernel.org Cc: Jan Kara <jack@suse.cz>, Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>, Matthew Wilcox <willy@infradead.org>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>, Alexey Klimov <klimov.linux@gmail.com>, Bart Van Assche <bvanassche@acm.org>, Sergey Shtylyov <s.shtylyov@omp.ru> Subject: [PATCH v3 06/35] mips: sgi-ip30: optimize heart_alloc_int() by using find_and_set_bit() Date: Mon, 11 Dec 2023 18:27:20 -0800 Message-Id: <20231212022749.625238-7-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231212022749.625238-1-yury.norov@gmail.com> References: <20231212022749.625238-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 11 Dec 2023 18:28:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785041370030667741 X-GMAIL-MSGID: 1785041370030667741 |
Series |
bitops: add atomic find_bit() operations
|
|
Commit Message
Yury Norov
Dec. 12, 2023, 2:27 a.m. UTC
heart_alloc_int() opencodes find_and_set_bit(). Simplify it by using the
dedicated function, and make an nice one-liner.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
arch/mips/sgi-ip30/ip30-irq.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c index 423c32cb66ed..3c4d4e947817 100644 --- a/arch/mips/sgi-ip30/ip30-irq.c +++ b/arch/mips/sgi-ip30/ip30-irq.c @@ -28,17 +28,9 @@ static DEFINE_PER_CPU(unsigned long, irq_enable_mask); static inline int heart_alloc_int(void) { - int bit; + int bit = find_and_set_bit(heart_irq_map, HEART_NUM_IRQS); -again: - bit = find_first_zero_bit(heart_irq_map, HEART_NUM_IRQS); - if (bit >= HEART_NUM_IRQS) - return -ENOSPC; - - if (test_and_set_bit(bit, heart_irq_map)) - goto again; - - return bit; + return bit < HEART_NUM_IRQS ? bit : -ENOSPC; } static void ip30_error_irq(struct irq_desc *desc)