mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: yogabook: use assign_bit()/change_bit() where applicable
@ 2026-09-19 13:08 Peng Fan (OSS)
  2026-09-22 18:17 ` Mark Pearson
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2026-09-19 13:08 UTC (permalink / raw)
  To: Mark Pearson, Derek J. Clark, Hans de Goede, Ilpo Järvinen
  Cc: linux-kernel, Peng Fan, platform-driver-x86

From: Peng Fan <peng.fan@nxp.com>

Convert open-coded if/else with set_bit/clear_bit to the assign_bit and
change_bit APIs.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/platform/x86/lenovo/yogabook.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/lenovo/yogabook.c b/drivers/platform/x86/lenovo/yogabook.c
index 1a4b2ab1f35d..f4c99508c6e7 100644
--- a/drivers/platform/x86/lenovo/yogabook.c
+++ b/drivers/platform/x86/lenovo/yogabook.c
@@ -120,10 +120,7 @@ static void yogabook_toggle_digitizer_mode(struct yogabook_data *data)
 	if (test_bit(YB_SUSPENDED, &data->flags))
 		return;
 
-	if (test_bit(YB_DIGITIZER_MODE, &data->flags))
-		clear_bit(YB_DIGITIZER_MODE, &data->flags);
-	else
-		set_bit(YB_DIGITIZER_MODE, &data->flags);
+	change_bit(YB_DIGITIZER_MODE, &data->flags);
 
 	/*
 	 * We are called from the ACPI core and the driver [un]binding which is
@@ -136,10 +133,8 @@ static irqreturn_t yogabook_backside_hall_irq(int irq, void *_data)
 {
 	struct yogabook_data *data = _data;
 
-	if (gpiod_get_value(data->backside_hall_gpio))
-		set_bit(YB_TABLET_MODE, &data->flags);
-	else
-		clear_bit(YB_TABLET_MODE, &data->flags);
+	assign_bit(YB_TABLET_MODE, &data->flags,
+		   gpiod_get_value(data->backside_hall_gpio));
 
 	schedule_work(&data->work);
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-22 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19 13:08 [PATCH] platform/x86: yogabook: use assign_bit()/change_bit() where applicable Peng Fan (OSS)
2026-09-22 18:17 ` Mark Pearson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®