From patchwork Mon Jun 17 13:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 13700896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28509C27C79 for ; Mon, 17 Jun 2024 15:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Tvabn+RMpG3uovvK1+JaZOuuhTQ0Y5v5qxh3XvN8Rq8=; b=LXyxfEQgQkUiZQC2MQ01TVRuW2 TgQBgA1PJxUTfray/syfKAxvpZ9NNe22s+ZIg+46LiNlJQJ14LawwA625xFpDQ7GfdLkny+N3SObw VWGD3BQKg5hAQ6bE+E6ewp3y1TG9h9biCacv3hk58GNf4U/jUufkbTWiIZVAjBCUS2NLN+TLpPDGx NkkX3ob7HoiFQiLY6d/JYA2Na2Lcld1F/w6g4flbcFsRsNwobm1eNaFT6T707uE172BjyKCoW0Z4B VutYIzxIVpL8WxzEZk4Jce8g74Zdo3/6BlYHgbMvEXv0IuVgzl/BfyfNtR9hhBhZN5gW3+GiL/Zed MBdGIxSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJDrd-0000000BKjb-28Cs; Mon, 17 Jun 2024 15:01:45 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJClK-0000000Axrf-0De6 for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 13:51:20 +0000 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-4405743ac19so37286291cf.0 for ; Mon, 17 Jun 2024 06:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1718632268; x=1719237068; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Tvabn+RMpG3uovvK1+JaZOuuhTQ0Y5v5qxh3XvN8Rq8=; b=dlE1MbUV/3GchDyS0Lmy79A/NM8UfMItarSueaNGHATVC6HWI9X0tNztqcH2VVhvdo BwOy6ExxPHxbR9JE7iqC1yi2DsdXZ1zMXNzxcLf4WDpd8GGFInSr30iXyMLetS8kDL2p KE/WBRX1vyuzJygAnBizDsAMKjjBghuZu8EuyM5ko3Q3fbOteEXLlFO5PyfM9rKwmKEH al2gVyxpjvdJkxdiqgH3TJ9Mbu3MnaTERWKaN7SHZaFnzxQ6hKB+g6s2dMICQgnOS3SS i4a5kKVrFT6zc4Ixe25d/P4nmpqy0FVfOz3srpQJtERk5N0SFNGT1Jyo38INgHE047dy MqTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718632268; x=1719237068; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tvabn+RMpG3uovvK1+JaZOuuhTQ0Y5v5qxh3XvN8Rq8=; b=ppUssrNiEBNRacHPw85KjuG5+I0uZYMxrd0+15P05Dn458iLXy+RrmtE+97EQzWygM mbsthCb+bRvhxnQ7Hnaz9cEnxSGUr8DiykA4YrQ1eNxC5WJSOHsfrMLADpcnGkKupYQn s2nxkR02Sfy6o0mwI26PXMF/K+5lX3O4iWbbToafFQd423+BHDSelAXQBfBB9KRV5z+1 ImdDdB6fyV1Lfdg8zfhhmMC0xyyWbIT4dBhy6Kg752Bg5avmXV85W8w3nKnT2ddzJQNo Q0y+LoovH0UcqEkf7YUwc7i0DnXlW1heDVB3JanEOam7jXI93aeF56mfM8WgYkFP4bHk 7Qcg== X-Forwarded-Encrypted: i=1; AJvYcCWqtE7C0SZXq+PTl2dJS1V0Oiq+MIp5WBUfF+pWuvCXKtHniVacdhoV5xi1VcdLP1cR/SpAHl5Du3Uw30k0Tjct40CLoRdU/tcgyPiX8Gp2PwOeH2c= X-Gm-Message-State: AOJu0Ywcg9lrcHzDyn2MBg9nLchBah9+nA7BZsDm9wFwj3FC5TQ3yKtB YZShmXS5WuES5oOJrMdPydmMBPSg8/x3jEXN5ubxD6FFj0SPXax8VjbmJYkneC8= X-Google-Smtp-Source: AGHT+IGCNTX7XI85nrdMwm8HgjdhSBF2upAbofRDQ4N0lo0/7MseIEDdacRNTzR/tFRJhwns3PxO2A== X-Received: by 2002:ac8:71d7:0:b0:442:198e:cb9 with SMTP id d75a77b69052e-442198e0e4bmr132788711cf.27.1718632268400; Mon, 17 Jun 2024 06:51:08 -0700 (PDT) Received: from megalith.oryx-coho.ts.net (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798aaecc004sm432892285a.31.2024.06.17.06.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:51:08 -0700 (PDT) From: Trevor Gamblin Date: Mon, 17 Jun 2024 09:50:19 -0400 Subject: [PATCH v3 39/41] iio: proximity: sx_common: make use of regmap_clear_bits(), regmap_set_bits() MIME-Version: 1.0 Message-Id: <20240617-review-v3-39-88d1338c4cca@baylibre.com> References: <20240617-review-v3-0-88d1338c4cca@baylibre.com> In-Reply-To: <20240617-review-v3-0-88d1338c4cca@baylibre.com> To: Jonathan Cameron , Lars-Peter Clausen , Dmitry Rokosov , Michael Hennerich , Cosmin Tanislav , Chen-Yu Tsai , Hans de Goede , Ray Jui , Scott Branden , Broadcom internal kernel review list , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Saravanan Sekar , Orson Zhai , Baolin Wang , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , =?utf-8?q?Nuno_S=C3=A1?= , Linus Walleij , Jean-Baptiste Maneyrol , Crt Mori Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Trevor Gamblin X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_065110_516346_1AEF0C2C X-CRM114-Status: GOOD ( 10.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König Signed-off-by: Trevor Gamblin --- drivers/iio/proximity/sx_common.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/proximity/sx_common.c b/drivers/iio/proximity/sx_common.c index fe07d1444ac3..a95e9814aaf2 100644 --- a/drivers/iio/proximity/sx_common.c +++ b/drivers/iio/proximity/sx_common.c @@ -111,17 +111,16 @@ static int sx_common_enable_irq(struct sx_common_data *data, unsigned int irq) { if (!data->client->irq) return 0; - return regmap_update_bits(data->regmap, data->chip_info->reg_irq_msk, - irq << data->chip_info->irq_msk_offset, - irq << data->chip_info->irq_msk_offset); + return regmap_set_bits(data->regmap, data->chip_info->reg_irq_msk, + irq << data->chip_info->irq_msk_offset); } static int sx_common_disable_irq(struct sx_common_data *data, unsigned int irq) { if (!data->client->irq) return 0; - return regmap_update_bits(data->regmap, data->chip_info->reg_irq_msk, - irq << data->chip_info->irq_msk_offset, 0); + return regmap_clear_bits(data->regmap, data->chip_info->reg_irq_msk, + irq << data->chip_info->irq_msk_offset); } static int sx_common_update_chan_en(struct sx_common_data *data,