From patchwork Thu Oct 31 15:27:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Stephan X-Patchwork-Id: 13858051 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 31DB41ADFFE for ; Thu, 31 Oct 2024 15:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730388437; cv=none; b=drpdoV7pch/vca5fw30tlLNCxW8itF1mayaK9JrBL4PHLX9lvqYPa1Zv5dlRBm7T6ESLC9SVvvgoc5rL/yYId6I8KiArLOxlEwTPaY9TyLf92cnLAx+mprwv1NA7uEaJTePKtoUDtgNw0YgNv38y0mEHB1GrkLgkO5v7Hzj2UuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730388437; c=relaxed/simple; bh=Crws9hBcBUgMNyTwteduHmHWY+ibF9suD+aQH3je7N8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eq28ZMNVbpXn9FoQamkENMGUsakgZyX38tLprK+BTJB0oewhBWi78jYj+diACdJiLpH3fcPc+bZCsrcizby8KYxR/6+u4JfmoDwwLf+hcCrwApm4V7WCmFiv6NAuw62vvy71mLbfpAgnwgu6eTLEBbE/rZVZ8SMQckAziRcJbQU= 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=r1kWn1E1; arc=none smtp.client-ip=209.85.128.44 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="r1kWn1E1" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43162cf1eaaso11531545e9.0 for ; Thu, 31 Oct 2024 08:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1730388433; x=1730993233; 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=JeXr3qZeoMT4Q41ImmT91MFFoZboqwE1uhQTfbeavwY=; b=r1kWn1E1yxvTzXA45e0pzvuWzpaLc9n7gdq3rd2h+2NGX4GHTIMtS8jjXUsQ7tpZII fojQ9BCloMjtlKeHHG73Ab8l7PdrLo4SdF/B7qLv6fHA1SVmRWASQcbZBX5I5xlRcCIB jap2avtU7jGqg09+89kMIiZvxfYICeYHMHV4F+qqeGlAfULxqIsgmUhvt+6+SwhAkZY2 68T2UkuNN5xk9OW7vSmM+wWLvGw8bnsHB5eWz+Njik7nybMCwIJkG0JirhffNDBfLrAY /d6bkX622Qd91F7WEQbF9lVz1K5rGqXc9vIxQs4dOruH/dp3wTKva0z2fEyFJXFUl8cm KE7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730388433; x=1730993233; 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=JeXr3qZeoMT4Q41ImmT91MFFoZboqwE1uhQTfbeavwY=; b=dvt3nJ4/RsZxl4yfO8j91yP01e+N3+/q6NA0uRe6wiDhwazqRddX40wo5gX0/dJxZc 5KJ6yVn3pd77xdZ4fgI5Ji6/IAwK7erVaQXidIVte8nQg5UF/Mu1kgz9cwp+ncbcGlWG 7XpiJi9LxmOwvcZtdHHSHITPhDe288ps0b1nDoSvwO3Uav4deUH4WQHh6DG5oPnGQG5b EuCjywacCGAdBuyK9X0usBE2DN83wUwYCWXoUCBxT70rNiPUTroKgqOqd/ZJa/HlU/mS D6HgOEMpMg8cQgH8swj1aXbRQUxqJr1HMfF9rL/rNaohJqGLw0W3LBaMzc/GtZsYO5EY kW/w== X-Gm-Message-State: AOJu0YzJojpeoJloyCiX5lUeTki6NAG1x51a5Ax4ovM5zbh1z0bzaFLc atLlOQ5nkG2ia8+a4n3Ny18ws92lPbvNP1Cz3UBte6l+Kmym0Wieb7aGL84Lb5M= X-Google-Smtp-Source: AGHT+IHhKXOtU6WrItuY3dPBqGFS+YCmx9LFZrBINQBT3KJgqU4GZtX+T26R8f/M/h9JuV4y1clo3w== X-Received: by 2002:a05:600c:5486:b0:431:52cc:877a with SMTP id 5b1f17b1804b1-43283296066mr2433515e9.34.1730388433589; Thu, 31 Oct 2024 08:27:13 -0700 (PDT) Received: from [192.168.1.64] (2a02-8428-e55b-1101-1e41-304e-170b-482f.rev.sfr.net. [2a02:8428:e55b:1101:1e41:304e:170b:482f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4327d5bf429sm29399475e9.12.2024.10.31.08.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 08:27:13 -0700 (PDT) From: Julien Stephan Date: Thu, 31 Oct 2024 16:27:01 +0100 Subject: [PATCH v2 06/15] iio: light: adux1020: write_event_config: use local variable for interrupt value Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241031-iio-fix-write-event-config-signature-v2-6-2bcacbb517a2@baylibre.com> References: <20241031-iio-fix-write-event-config-signature-v2-0-2bcacbb517a2@baylibre.com> In-Reply-To: <20241031-iio-fix-write-event-config-signature-v2-0-2bcacbb517a2@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 state parameter is currently an int, but it is actually a boolean. iio_ev_state_store is actually using kstrtobool to check user input, then gives the converted boolean value to write_event_config. The code in adux1020_write_event_config re-uses state parameter to store an integer value. To prepare for updating the write_event_config signature to use a boolean for state, introduce a new local int variable. Signed-off-by: Julien Stephan --- drivers/iio/light/adux1020.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/adux1020.c b/drivers/iio/light/adux1020.c index 2e0170be077aef9aa194fab51afbb33aec02e513..db57d84da616b91add8c5d1aba08a73ce18c367e 100644 --- a/drivers/iio/light/adux1020.c +++ b/drivers/iio/light/adux1020.c @@ -505,7 +505,7 @@ static int adux1020_write_event_config(struct iio_dev *indio_dev, enum iio_event_direction dir, int state) { struct adux1020_data *data = iio_priv(indio_dev); - int ret, mask; + int ret, mask, val; mutex_lock(&data->lock); @@ -526,12 +526,12 @@ static int adux1020_write_event_config(struct iio_dev *indio_dev, mask = ADUX1020_PROX_OFF1_INT; if (state) - state = 0; + val = 0; else - state = mask; + val = mask; ret = regmap_update_bits(data->regmap, ADUX1020_REG_INT_MASK, - mask, state); + mask, val); if (ret < 0) goto fail;