From nobody Tue Nov 26 00:26:38 2024 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 1055C1B85E3 for ; Thu, 24 Oct 2024 09:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729761177; cv=none; b=LUucONQbqmSMdR1k6Vspoj68gZ9JzpdzoyxkAd45g6ZB00ZvFFVoCfIVvC2Ld8FY0qET97eyoWagg0h/YSNLilPiK/dWt5fLeWgqqjWe5RDjKPOZ57F4smeQgM2v25hJM/HKw+qiKgXhwnZ32vlGnQ1ALWs469McFAOTrNcAHw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729761177; c=relaxed/simple; bh=EvZTfjPuH+Sw2tva9CA/YuYYsffYBvbQ9xRBfy4MGH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C3DKxZpaXa15JxCfi9t/UAizDHNI5iwVNISXoYdMEbMDwhf6iFWUEPk60UtD7cZXW01TRa5PhN9W/QTRgPiNaOZKGW2XA0NM7bXOknzh8UD4qURUUqt4+k4NGczzB2SlFAid5525lFg6Q7p9RJN7UT9rBRVyC6jcmkcL2lD/zp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=UEB3NOKi; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="UEB3NOKi" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-539fe76e802so803557e87.1 for ; Thu, 24 Oct 2024 02:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1729761173; x=1730365973; darn=vger.kernel.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=HpXwrqa5mh4an1VW52USOlgjMJ2X4POeKu7/qnEQ85Y=; b=UEB3NOKiu7qiJQ+wpnQ+mQ5/yijjJUbHhY6+b09e6YYZm4/CWGkN3fWh1tJlaTQSK/ S/N629d8wE4wniYUVGp6HM5ShYNr4ob39W+XlMeNkFjDdf33MYlkqq4oPLxVlRFNhWlf z7A1vlXEaLKVvsDGbsSLLc7jMunz+7wmUsFZ7LfIJeg6oR1NYHPtMuu4QVmV0x5CNT6d XXvhkXS74OoyobaHe7zkzNsKSuv/mAi7mKvAAqHaY4dCuiZZx9pdpB33QYq+4oX0hHpe xQ+VzxlzQspIT9IECXZEd9OtEktWpW9xJ05m8mruDuUTGfuOzG+eojB9N31QMqcYEMZb 0xGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729761173; x=1730365973; 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=HpXwrqa5mh4an1VW52USOlgjMJ2X4POeKu7/qnEQ85Y=; b=E5Q/EA8N6mKcfUnM79scO5XVYmG7N2tDaMvAYlgnl6tL2tNUcu2ep1RK5lTUOHe2k8 a36UTDdHGoqSnDUrYOb4OuVyUk8bcQxgJxef4R7wqRRd/ZLpHhIz2gnWdlNqpx3mwpiE N7cUXgSwMJAmBT/RoD4jCESKNfe2ANdzi6vaBPDUu+8c5CHctBTUIrwDFocF9UwOKfhF 4M3P9ub5hX28B7bQxLu9ijE5lVC8JrZ/ZUyqJsCnI4N9asMt+Ttc4c6i9d2a9EppA80I BTX/GqSWE5MEBUKnvez+mDr1xe2pKKUb7KgrPhM358e1Ooj2UrTea2NWra7oMPLNSjHe xmkQ== X-Forwarded-Encrypted: i=1; AJvYcCVDt2bR5LEaRoNV0ngOjWEPElt3BZuKBPEb6+4PDTigUsvKmrIGmxdtxeJDOT1vomV1XvXr4YdZ1K5H004=@vger.kernel.org X-Gm-Message-State: AOJu0YxtA2dXsOzEakNtpUv5GmPYrZEHdq+Ml3JNIxctUNhOLZxLO1UI my8Wfefv8U5QXTbRRqOlTlSchrfQ6hHMY/nGmhu1DHsh2w5SqUkNtVibQfmJBz8= X-Google-Smtp-Source: AGHT+IHjMTzdOejYpXdaJTcSXe71t6xMLTv/MupAWuwwaYamFeQSYvZEYBgJNNUbqbvWU86WqzOMBw== X-Received: by 2002:a05:6512:3a82:b0:539:8b02:8f1d with SMTP id 2adb3069b0e04-53b1a3392bcmr2894072e87.30.1729761173024; Thu, 24 Oct 2024 02:12:53 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0b94071sm10843701f8f.89.2024.10.24.02.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 02:12:52 -0700 (PDT) From: Julien Stephan Date: Thu, 24 Oct 2024 11:11:27 +0200 Subject: [PATCH 5/7] iio: imu: inv_mpu6050: simplify code in write_event_config callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241024-iio-fix-write-event-config-signature-v1-5-7d29e5a31b00@baylibre.com> References: <20241024-iio-fix-write-event-config-signature-v1-0-7d29e5a31b00@baylibre.com> In-Reply-To: <20241024-iio-fix-write-event-config-signature-v1-0-7d29e5a31b00@baylibre.com> To: Mudit Sharma , Jonathan Cameron , Lars-Peter Clausen , Anshul Dalal , Javier Carrasco , Jean-Baptiste Maneyrol , Michael Hennerich , Cosmin Tanislav , Ramona Gradinariu , Antoniu Miclaus , Dan Robertson , Marcelo Schmitt , Matteo Martelli , Anand Ashok Dumbre , Michal Simek , Mariel Tinaco , Jagath Jog J , Lorenzo Bianconi , Subhajit Ghosh , Kevin Tsai , Linus Walleij , Benson Leung , Guenter Roeck Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, Julien Stephan X-Mailer: b4 0.14.2 iio_ev_state_store is actually using kstrtobool to check user input, then gives the converted boolean value to the write_event_config callback. Remove useless code in write_event_config callback. Signed-off-by: Julien Stephan --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 7 ++----- drivers/iio/light/apds9960.c | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/i= nv_mpu6050/inv_mpu_core.c index 5680be153127711777b6074da18a7a0f86211d6c..21ebf0f7e28fec302cbf8ab890f= c53a3de6f36cd 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1176,21 +1176,18 @@ static int inv_mpu6050_write_event_config(struct ii= o_dev *indio_dev, int state) { struct inv_mpu6050_state *st =3D iio_priv(indio_dev); - int enable; =20 /* support only WoM (accel roc rising) event */ if (chan->type !=3D IIO_ACCEL || type !=3D IIO_EV_TYPE_ROC || dir !=3D IIO_EV_DIR_RISING) return -EINVAL; =20 - enable =3D !!state; - guard(mutex)(&st->lock); =20 - if (st->chip_config.wom_en =3D=3D enable) + if (st->chip_config.wom_en =3D=3D state) return 0; =20 - return inv_mpu6050_enable_wom(st, enable); + return inv_mpu6050_enable_wom(st, state); } =20 static int inv_mpu6050_read_event_value(struct iio_dev *indio_dev, diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index 3c14e4c30805e1b596ef2380f94e6aa3e92082b1..3a56eaae5a68f2891d061871c70= 13f0b5447bb47 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c @@ -762,8 +762,6 @@ static int apds9960_write_event_config(struct iio_dev *= indio_dev, struct apds9960_data *data =3D iio_priv(indio_dev); int ret; =20 - state =3D !!state; - switch (chan->type) { case IIO_PROXIMITY: if (data->pxs_int =3D=3D state) --=20 2.47.0