From patchwork Thu Feb 15 13:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 201456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp387650dyb; Thu, 15 Feb 2024 05:13:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU2VrBprBnkl//5KEf8GgphaqxVw3PZPbBD6BsBV8+sKeciDtziO6QMntgoNjpDo32RzjDHR9+R6K1HR4Zd+noCfPVD6A== X-Google-Smtp-Source: AGHT+IEsq5oUW6ULobhafBoVLocWyLHcLksxHfZKqGPR8ZlFOUi3HS/jDM+YMso2lZMpR+fNq7e2 X-Received: by 2002:a17:902:d2d1:b0:1db:9896:3eab with SMTP id n17-20020a170902d2d100b001db98963eabmr622037plc.36.1708002794482; Thu, 15 Feb 2024 05:13:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708002794; cv=pass; d=google.com; s=arc-20160816; b=BeZM8pO1Cnbp5n9gg5rIP66pQHdFske8GHpy0sNcY1mmJ2F44uWW+S5PpO+KQE2X7R 9NMqdIAa3zwRAfQfoy2KcOGgj5MSzrn4xVTAlY2CHOSQU6yOYIOj7kUpifRnmMZ8si9V wF3Dsc9ybwyPRTQ36FayjZsl6YCNr0BEH+PMXpevQm1XxHR5vcdxDQDL1mj4+a6Vw4A0 0eRyqOt3HyY6ytWKCRLO92xUTY6k7JRIEPeJoKqRx6FtavsOtfEVf+fwUVdZ04fFo145 8yYDgxHAIh1EnHodnOknl+v6nnnsfC+hXCPUsp7oYNmqyuutr9aqsIBUnS+Bj9PdItc8 wW9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=ol3KmV7kGEpDxk6GGwS9x4r/jkEUD+0bOtg/Uqvv32Q=; fh=FdZaWm9HVp6vTufomMZOleyIvg0+ax5kVvdPQlnV24Q=; b=f4B4pCNAew3Qhw6sJTULfQ/7vqYgb/1P0/fph4WjLPTEBr7dn4nT+lEygO5qrRodSa xGaNGwYdWmI1rnpnsriJHryQpkMPZ263w7/po3iGFmorIvHmSp/x8TqS9dwhZr3i/dpo HRDhT5cMeZelwWVuyUs2Qp5LrNaUCdWEhZ3rlz4y04nfaOULQASeYT1nhedLfwwvyXRg tHbjREv+pdlIGFE/QsyFjnal97djCENbYjAPOd/EmaBr4CNonxildvICY5Ur5jf6qgru qRue5ZLlCtKDG/vCv8kv6qF/Sr9rK1F5xGVQR0orD8BtUZUJ0Ynf2FWCM+qbQU/mQnKU DuLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-66955-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66955-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mf14-20020a170902fc8e00b001d9ec0e2704si1098679plb.488.2024.02.15.05.13.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:13:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66955-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-66955-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66955-ouuuleilei=gmail.com@vger.kernel.org" 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 E4404284C3B for ; Thu, 15 Feb 2024 13:09:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAC1012FF8C; Thu, 15 Feb 2024 13:09:35 +0000 (UTC) Received: from michel.telenet-ops.be (michel.telenet-ops.be [195.130.137.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BB0A12F5B6 for ; Thu, 15 Feb 2024 13:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.88 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708002574; cv=none; b=q4QJiSkKIA85WpePAS14sbct6WtzgcL9NRXWviVZX6PEqcH5zYkfnvOR9n1nT7y4gWqPGGBkvJ5wUw/bGaFq+JQnfLjLeODUrMygfiOk9jyVP2P5pumPdQuB2NpOshK+3BDeMA9gQxU4mGvUpKBeYjx6CJ6C+KQWNYcO+DCaiu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708002574; c=relaxed/simple; bh=LdhE3W0DKxNgydIxqfNhRP53fhR33mH9xifCv+GNwsA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=URWp64THBfJGDZeZHAwHkgPsnv7Yl93gICVGOJwz2XbppC7ntZAAY5GEpyo7ZoIrswmFflD6/2zQIUGtTixVs9jcM4diI6rtgMMmFQWo4MkuHje1A5jYq48Gt1TJ6JUD8ccaxbqHEm52NqQZVMq4g1D/yYBlq6N+vLTMcL84PIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:ac52:3a54:2a84:d65a]) by michel.telenet-ops.be with bizsmtp id nR9P2B00D0LVNSS06R9PnN; Thu, 15 Feb 2024 14:09:24 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rabUK-000gy0-AI; Thu, 15 Feb 2024 14:09:23 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rabUR-00HZ0d-La; Thu, 15 Feb 2024 14:09:23 +0100 From: Geert Uytterhoeven To: J Keerthy , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] regulator: lp873x: Use bitfield helpers Date: Thu, 15 Feb 2024 14:09:18 +0100 Message-Id: <15edeaa9a644c4025234088da3dabb023fce04ac.1708002503.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790970737721795773 X-GMAIL-MSGID: 1790970737721795773 Use the FIELD_PREP() helper, instead open-coding the same operation. Signed-off-by: Geert Uytterhoeven Acked-by: Mark Brown --- Compile-tested only. v2: - Add Acked-by. --- drivers/regulator/lp873x-regulator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/lp873x-regulator.c b/drivers/regulator/lp873x-regulator.c index 8dfdd1db20709e18..84a134cfcd9c98d7 100644 --- a/drivers/regulator/lp873x-regulator.c +++ b/drivers/regulator/lp873x-regulator.c @@ -5,6 +5,7 @@ * Copyright (C) 2016 Texas Instruments Incorporated - https://www.ti.com/ */ +#include #include #include #include @@ -93,7 +94,7 @@ static int lp873x_buck_set_ramp_delay(struct regulator_dev *rdev, ret = regmap_update_bits(lp873->regmap, regulators[id].ctrl2_reg, LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE, - reg << __ffs(LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE)); + FIELD_PREP(LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE, reg)); if (ret) { dev_err(lp873->dev, "SLEW RATE write failed: %d\n", ret); return ret;