Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4306624rwr; Sun, 23 Apr 2023 02:59:41 -0700 (PDT) X-Google-Smtp-Source: AKy350aGrfogLMMYqDqPJssiFuy5BvxSgL7CAC6skwtv3ZNkpvBnimBo+oUhl75AN/j0Fbo1whX+ X-Received: by 2002:a17:902:f685:b0:1a9:4167:5db7 with SMTP id l5-20020a170902f68500b001a941675db7mr10124847plg.4.1682243981025; Sun, 23 Apr 2023 02:59:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682243981; cv=pass; d=google.com; s=arc-20160816; b=yOgZELoTmGxsea6ziD91Vc2EvssZwHu8yrMufIZBnPd6J75mx//zdX7Azbzr3KtAJE OAxJId2QWsLDXW0Ym6ihlYIbH/kz6n65sgrNOEHcdNLkpnRkuOoTnhs6q5MKYKaeFHS5 ESRCfPjlFc7YaHThl/RVgJHNthwYyzSokuvalmK38x0sAYUVEBA3/DV52ea908wL0oHC h9djwCRHMll+wfrjY9myCbCnJZYVqEPpJju03Zp4ohzJDNxTtvIp18BLJ9LdbLf5kdil YyimdGmgrAYqOv/CVqE+rVZHQd/r9+JBm8IzUN5yhgFUZEoBEpt8YbxPj7H03+VujtV/ MmOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=7ajPr7tZ7gzOL2AAofFKGLkONv5fpHrXV9pX+0gP42s=; b=K6hhSYBg5m/ZpsgST7+VgGFz8egy5n81VInbeeH0l0VlxI45+NSswVLJoJvTF5JnKO cF13JvFjbnnoH1PImI3TkApeIVF2dlXyimC5kB2GnSVVggHh1tJQ9bmglExO9GPzsmfB IRlymCW4Q3KU50mLqVzio59NjX+pQe5lg6EGNzrB9+79CN1ciwPgidDw4L9G28BoA9gU jJuiiEFv7vbYt47bQiJbRBZ73Ou7B7jAfkCbrrMnEFk6nbJDPugK4XIUbIr6LSgEnbUE WWnop70H7G1kGDgLVmg+uxi9IgxNypoWnEbsH6onHMWHwe6mIdNeetNoyBmiqgUV/IPq soew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=u9aijyhF; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a17090aa79100b00232dd9ab146si5032221pjq.13.2023.04.23.02.59.30; Sun, 23 Apr 2023 02:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=u9aijyhF; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjDWJH0 (ORCPT + 99 others); Sun, 23 Apr 2023 05:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDWJHY (ORCPT ); Sun, 23 Apr 2023 05:07:24 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2053.outbound.protection.outlook.com [40.92.53.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26AD010D9; Sun, 23 Apr 2023 02:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rg2ye70yGuR0ol1gEPqmKHvKMcJ3StHTCGNd6zXd3+n3rFWOHoqc5e1UkYrdncJibhUe/vKAoWmErSqlXZmrw8DPO5eLIaFkBnSFixsGm9ZDuaqRRGY/cv2e+IP/dD5CUkuYvhIMo37qFnjGmKS++JLKVDM1iVk3PqqmjwhkCnewBorPr0tdUp6bKB+mDhOJeTVbUhgb4X+0h3KKSkTonfcWdgcYDFsu4gwnoCwv36pgxRJiDbLaLfdCWTy11DxfDrdwb35HlubS9en9/2JhJ3eHqGTXBhJCt7SaQpnEaAm9cGg3FpAy7NM3tcRUtEQoTy/zlpx6xisc62jRny3bYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7ajPr7tZ7gzOL2AAofFKGLkONv5fpHrXV9pX+0gP42s=; b=ZHiu5pGuWItqIoqsX/drQhQxvAoooRiaQmj8BfqU4OP1OObXp3sTTuE+fbUO9JEcRE6oytVwfSZuKgC/Yrc+jf7wnL1AEsR+fs8ohZVg6FFsLWXnVbXNjw5JJW3+Z62cDqrfGGfqX8rASKXzXi/VZPP9X6WbtixBLkr5aX7slnTb1OjkD6rxGhX/vjGtNNX8oN1QkVvP/4Q0BnkTdd7AaGpH3CNuP/SRnfvRzoCSv7soAucvDPfr1ax5XF6/IyoXd66gRINTUPlGDZPPfcQalrZNzy0NKnfojRUDg0fx5nJy5NByKILkkdi249ETWHamogH4/Fw1RDBU/VWgLrNQPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ajPr7tZ7gzOL2AAofFKGLkONv5fpHrXV9pX+0gP42s=; b=u9aijyhFNDJujuROu98qoBRkHzIwymV/GJYk8ich5dr5bBbzuuJdyTLotwZtCHZspU4oLGpRHuS5rkNZuEZ82w4gP1PtwwymJ9LKb79HbPUoNSVoXGIJZ43ijHIP0ItejWeEGyxHsBGccqF2iXf06NkIfwUBjqRDclDYOmTa/4FeXwkAb3+5RaF7q6zobuL+wgNO+xw/M9QzMBu8CpQGxfXZqBhaNOdoAuOEjtJStINWnoVnbG9j5QnXLqeFChKxKZ7phPIcNJ6Y8s5g/buMUmMHL+cuVT0PTaWVx2YuSb/pgzrXRBQ6+JdNLAtKGM0kF17AEMu/SwjX/nVtY6dq/g== Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) by SEYPR01MB5076.apcprd01.prod.exchangelabs.com (2603:1096:101:d1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.11; Sun, 23 Apr 2023 09:07:17 +0000 Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::5bff:fd7e:ec7c:e9d3]) by KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::5bff:fd7e:ec7c:e9d3%5]) with mapi id 15.20.6340.018; Sun, 23 Apr 2023 09:07:17 +0000 From: Yan Wang To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: Yan Wang , Andy Shevchenko , linux-gpio@vger.kernel.org (open list:GPIO SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1] gpio: mmio: restroe get multiple gpio mask Date: Sun, 23 Apr 2023 17:06:48 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-TMN: [fhe4TsjhD8S/2z2nNncUhHci38xkQjQYa+UPKqAQ9zw=] X-ClientProxiedBy: SGAP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::17) To KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) X-Microsoft-Original-Message-ID: <20230423090648.20882-1-rk.code@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR01MB5448:EE_|SEYPR01MB5076:EE_ X-MS-Office365-Filtering-Correlation-Id: a549ac5a-8928-45d5-52d5-08db43da2312 X-MS-Exchange-SLBlob-MailProps: 70qbaZjg4mut0ZTEc/+RhwzsFjQD3otITfzPgwyCuh3DXz2qZZ6IBn1SP72dI6E6t9fdYxuEdZ7617P3ZbTzk/OpEuBrRoQtedzx591hTrW/KUdpUINc6ZLcigV6Z+TxPigBSpPZdNX47KLla6VgHT3WqtkPvhfypKShd7qJh7AbBPKVCrmhqVaSb1en8xpi6Dnv/I7MWLzof9d4TMwycHEuPxAZbbnGu5z5cE+wvKcVaeT0yayS9szhqj8pg/r7WE+dVxVSydNyVS9SqmVzlDlfEI2yeiMm2nidnt5Qrh1LTXepE5+sNMJXXWHUwT5W5544ZGiZQIqY2gWTrpnhKM5U1StISPXOISFGsZsepvxcQRGd/ROmpQfDm3NQgcdys/Vjt6MH5vVjAfdxkiwjXP9WQ9jeaZ//W6lHts0J/ScTGVW7fZH4qCSwijUt2OG2+NiRTjKTpryg0lHcrMTP2u90FvGegAwidCq/UFhUf0H9tG3ZER/8/asrjZDlXVoMgtT9LDmOctxPaVFlsLcGA1oFZl8JPDn59XEuIeJmjYwvWQQopAQEIsZIoSvdb7wFeaIYmF1hdm+8Q2frgt5zzMpufU5tcwAiP9XMAoWHsPVv+pRE0zUhjwhKyn0G+NzcE8RYs/Tve0EdVYY6uf/U9ljYSSok//t+lRUwu5e7+9tEjIXd1g0ZYGZC/yZW+nifidmWsWUFuLXb5FgAu8fofdvrDyLQLcHMNuzma8DI7GACGSg47wKSlA== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V0rmyYpytac58hvR7AB9YL3GzhYVY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4?= =?us-ascii?Q?A/gno1onA5plNqBGEvxhlGyV/ixMKbwjsjP6EA=3D=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a549ac5a-8928-45d5-52d5-08db43da2312 X-MS-Exchange-CrossTenant-AuthSource: KL1PR01MB5448.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2023 09:07:17.5956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR01MB5076 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify the code,should not modify its logic. Fixes: 761b5c30c206 ("gpio: mmio: replace open-coded for_each_set_bit()") Signed-off-by: Yan Wang --- drivers/gpio/gpio-mmio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c index d9dff3dc92ae..c2347ef3a4df 100644 --- a/drivers/gpio/gpio-mmio.c +++ b/drivers/gpio/gpio-mmio.c @@ -271,10 +271,14 @@ static void bgpio_multiple_get_masks(struct gpio_chip *gc, *clear_mask = 0; for_each_set_bit(i, mask, gc->bgpio_bits) { - if (test_bit(i, bits)) - *set_mask |= bgpio_line2mask(gc, i); - else - *clear_mask |= bgpio_line2mask(gc, i); + if (*mask == 0) + break; + if (__test_and_clear_bit(i, mask)) { + if (test_bit(i, bits)) + *set_mask |= bgpio_line2mask(gc, i); + else + *clear_mask |= bgpio_line2mask(gc, i); + } } } -- 2.17.1