Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26598948rwd; Mon, 3 Jul 2023 11:58:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6s1xfy2IvKB66oNbbQ3+fiptkASNAAtUz+2og3l/D8dA/G9v6elDv8XYEVD3SN1r9SlD/M X-Received: by 2002:a05:6a20:244a:b0:110:5141:dc8d with SMTP id t10-20020a056a20244a00b001105141dc8dmr8224718pzc.25.1688410727693; Mon, 03 Jul 2023 11:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688410727; cv=none; d=google.com; s=arc-20160816; b=Lg4I9Y6sZVLhjiborJBug1OFSZF5BgaRpQXc/xsNJNWL4VRuL7K0VkjdwY/Wkmjy7Z ZcOQ9LnKewrWdxChF6hbBkAvCJW8/QEcA5FlY/nmVKU4DCm+m4ticDaPoSI/OrngM1mV wFqrV7MJA/Hiw4jOhpxReqjJXWkMwkem1G+DePfUvXTK0/wLzDTADNP3kRBBwmUClxnE KZT/qnQ23Tqry5+0N1OJ96H6S6yN1FJtTdyzcXWWvW+6yR4kKqMqm4pCp/GsUARvB8Qb tVtYpzryXkNaKvDT1f7L+avzCN4wgxdNL2NiqE855eWtFKcQ7QxR7Scu3qZYkkeCPVxt +LwA== 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=YgJDGoUZOxxqUPpPhoY2XTp/tSF37oJhkqsj4a/w+Xo=; fh=5yeSY1SX/5BYKJ3zhDzboq66lb94ksAw0qpQI5n3Am0=; b=M7OId+yCDVz+cgIsp9eMYJ/NKbTwJOsYWAgDFJrAEH7D0asCh6Di9ndJWNHtkBgqUs 2B1RyU4fN8OqOhiGQyq+b309X20znwlFHZ4KvcVIZi6XNP+J7ZWavTg9ufpzCo8qY9/F EeKI9zyOwOlDBC+2CrnytzCRaEpNb3M+S8C8GqwO8Q1T7Frwl0qX+/PqS/DE8rmuLWNT k/MiC+6grCei/UMgJIf6vxsrC5inACL+kGaeAG+BFRHt4PUneEdF9f5SwGpAWR42Dntf 9BQWTsjYcnn8ntHk9WZIVvTAXGQ/beCqk+gHoZ87437V50RfkdRjdMCRPsGs4sYNqkor INRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hvhHGQ6p; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a056a0014c700b0067f69d10241si12797819pfu.176.2023.07.03.11.58.33; Mon, 03 Jul 2023 11:58:47 -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=@intel.com header.s=Intel header.b=hvhHGQ6p; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjGCSwa (ORCPT + 99 others); Mon, 3 Jul 2023 14:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbjGCSw2 (ORCPT ); Mon, 3 Jul 2023 14:52:28 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B4EAF; Mon, 3 Jul 2023 11:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688410346; x=1719946346; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vglDNwRcSKOGrj0IrUTDI9q4BegirR6oTWfUcwYB95I=; b=hvhHGQ6pBcLzrfrojWdTfuTNXb3IE4OaRkARPiR4eTLUftqkbUUqF2ZO dNOe1qg4X5L1RXZxIJjIBxX92fp+02hcGJWWhULRyHsNwCwY92oxiVrEx ZCLKr24w9MwPUAKyhvm1OrkNZpKUx8vpS5wLDNjMY/ZxOmXD/OkSILUWC hSI1QyDGa9znvuS98TkFwt99bwsN72McFNSz2QrKNlnvI+CNwrA6SQyGN bjH1B3DcOSAfM5s114qJSX3y7fYK46CpyhjQ057Pk0FRUCUFxIWe37BRS 3nU56ZGlym+NtnfzMFWrqClm0f7G69RFfku+VkezB93WkflteSFvk7gWc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="362986960" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="362986960" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2023 11:52:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="721860811" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="721860811" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 03 Jul 2023 11:52:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4B284178; Mon, 3 Jul 2023 21:52:27 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Andy Shevchenko Subject: [PATCH v1 04/12] HID: cp2112: Switch to for_each_set_bit() to simplify the code Date: Mon, 3 Jul 2023 21:52:14 +0300 Message-Id: <20230703185222.50554-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230703185222.50554-1-andriy.shevchenko@linux.intel.com> References: <20230703185222.50554-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 It's cleaner to use for_each_set_bit() than open coding it. Signed-off-by: Andy Shevchenko --- drivers/hid/hid-cp2112.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 51399b231d36..fb4548feb0c8 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -16,6 +16,7 @@ * https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf */ +#include #include #include #include @@ -1100,7 +1101,6 @@ static void cp2112_gpio_poll_callback(struct work_struct *work) gpio_poll_worker.work); struct irq_data *d; u8 gpio_mask; - u8 virqs = (u8)dev->irq_mask; u32 irq_type; int irq, virq, ret; @@ -1111,11 +1111,7 @@ static void cp2112_gpio_poll_callback(struct work_struct *work) goto exit; gpio_mask = ret; - - while (virqs) { - virq = ffs(virqs) - 1; - virqs &= ~BIT(virq); - + for_each_set_bit(virq, &dev->irq_mask, 8) { if (!dev->gc.to_irq) break; -- 2.40.0.1.gaa8946217a0b