Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30B791E4B0; Sat, 26 Oct 2024 12:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729945879; cv=none; b=qsbNfulHLO7+VGFEYZDFSdLtR4e18Od/yHPvlBU22f5J9kHmRBs6dhIv023VDMSwVggKgcESO0L19/uSoLMJBY0YSJ97XjSYgovNHpo2k4gq8Elp0Kn6XPF6Qf4c/RQNE9aPpp+0xcDjKteaCDB9l/guseZS3ij4z3uPkEg8NDo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729945879; c=relaxed/simple; bh=R/H1PsXY01GRskZLD70K/F7ZGE40dFF0NFTDLydVC68=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eqBnWBr/B32UDTHp81xSRI1t6bAGO53sEPMBn8SJLoHm/NltT29CcWT1UFlAiPrZEI/GmywSUfTYoXZyRNc0tgh6B4dCsUqFgbN4tjKUbWIf7v1Qp0hhqWJHLfGCKCO5rffiM2YaT6C2uEUzu3FuwZjOJurMfm8h7PY3Xnr9jT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lUJk+S/M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lUJk+S/M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964B1C4CEC6; Sat, 26 Oct 2024 12:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729945879; bh=R/H1PsXY01GRskZLD70K/F7ZGE40dFF0NFTDLydVC68=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lUJk+S/MQmFzr4RKHIxhUiy2zUnLAqzIEuKoF4/RJ1b6grii7PG0WGE0zSq56hwXz bWZO93/MhN9t4cymKBLENf365sT7y+crOFNauUI5/RvZ3zaOv7kt5bcPrMwphM1Pw8 amChXnPLlCREf8Gn5pnVGKp7lsB5xQZr6JDdOJQ2fEdjoocIN92Gqff0Bwznd49FIY 69LG+TEsmW4gnqlk6xBMe+DvUZapZFvbil1wxVhwR7RrGECOGpNnnqj3SuXEakYgDB bZvuR5tsKw6XrN+EsFA0ekPrkTsn+jMQMjRU+7inIPiCc4odTMEFBnRjomwwpsRkF6 NsgwNdAKhGcug== Date: Sat, 26 Oct 2024 13:30:39 +0100 From: Jonathan Cameron To: Julien Stephan Cc: Mudit Sharma , 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 , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev Subject: Re: [PATCH 6/7] iio: light: stk3310: simplify code in write_event_config callback Message-ID: <20241026133039.10742c75@jic23-huawei> In-Reply-To: <20241024-iio-fix-write-event-config-signature-v1-6-7d29e5a31b00@baylibre.com> References: <20241024-iio-fix-write-event-config-signature-v1-0-7d29e5a31b00@baylibre.com> <20241024-iio-fix-write-event-config-signature-v1-6-7d29e5a31b00@baylibre.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 24 Oct 2024 11:11:28 +0200 Julien Stephan wrote: > 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 This one is odd. The field is 1 bit so I've no idea why checking against 7 would ever have made sense. Applied, but if anyone is familiar with this part I would like more eyes on that code to see if there is a bug hiding there. Jonathan > --- > drivers/iio/light/stk3310.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c > index ed20b67145463d253a0dff28a4c1c3e02e710319..c6f950af5afa0f77a617bd2baf0a08eef5ec26f0 100644 > --- a/drivers/iio/light/stk3310.c > +++ b/drivers/iio/light/stk3310.c > @@ -330,9 +330,6 @@ static int stk3310_write_event_config(struct iio_dev *indio_dev, > struct stk3310_data *data = iio_priv(indio_dev); > struct i2c_client *client = data->client; > > - if (state < 0 || state > 7) > - return -EINVAL; > - > /* Set INT_PS value */ > mutex_lock(&data->lock); > ret = regmap_field_write(data->reg_int_ps, state); >