From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (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 9B93640D595 for ; Mon, 27 Jul 2026 13:16:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785158165; cv=none; b=O6k51wAIQcs+4FSrmFGG7IHcb02XyGzcilovb0JLg4VjvcLQ0gooeMHDdNJjWFLg3Kem95XgxSsOK1ndt9RP8OkQzvQOyH/D3UgjpWZS0+TH6FwJ6oD4cs05wd2DdHYWgy9mHAIoghoj0vhsWgVweHcAqZHG05WNQmES9koecUc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785158165; c=relaxed/simple; bh=vZMr9iQgTrhaW6/vjBCqkFmJh4apidKCCeVtFnDugBE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aooFfKa4hOUOUfMggLIJ3TXCsiw4TgjK5sorFQeQses5/XzsqldaTV+n6aCnqxFRRtc1Hmgwfaq64Wkq39pRrHySs8bXZZTbsDOFpwGHdfVkDtFTXo8NMoXyoFZ5K6dqi9x8LJDMkCl1KidkYm3IizWtAUBZRoOXQKdHh3c438o= 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 header.i=@baylibre.com header.b=F6Uc/SaZ; arc=none smtp.client-ip=209.85.160.43 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 header.i=@baylibre.com header.b="F6Uc/SaZ" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-455a61c53d3so1405812fac.2 for ; Mon, 27 Jul 2026 06:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1785158161; x=1785762961; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HNKl3M/VR9azOE61YALP3ovVcBBley/hBZMseKoNWEk=; b=F6Uc/SaZl0xa0Op9WTO6bpIjncl3rnWFp8nnYzyqT6M2bCjcKenEzM2cz4hYi5I7AC Kf7DrLdDA8lp4Si6T4MwOiDubA7oFsOPO243UuhcvfE/5w+jrJiqovzBWblDL/Epa2Cq oX9JwAxV5onys7UhWFtkeDollbrwDSjV4sOeVS2qfCAg1vmEytDzfxmW8jtR7q+kKJRa HmzpihZOJe9zNWl2bEi59Eugu1kctJF0jFBQ+Z5gQCvI1PBYfyIhLYjEEiuDbNItC2je j7dlcObDHn0zJ/rd8S29XpX1hVp8RptLYV3mS96KfqQBuhmVpD53afKDFkwNnw6I53ZU S62Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785158161; x=1785762961; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HNKl3M/VR9azOE61YALP3ovVcBBley/hBZMseKoNWEk=; b=IFAHrrLfy3oeEynx0wr7Lnp3pWVlb8aqJXvsnuYbHLd5MFJMv9tZ0V1L9dULiUWQ7f rJMpzzKobmYMbl8H0US4JpfFGOWb0db0Z2PfPiO8h3pRvBdsUUt8eeR8JYkkac9jTOZS NU0FLpOwLU1CyNxqJ9FUizZDfF1U/HVHsFRLppAqrBZCUIBKgHaZKwBmK6Voh45zpP2W fxQ06WWhtKKTpsL5tkECRMrccIzksf+6tIEGwDja2ItwUI/l/ptHtENxG9UzEERD4ii1 JUyRmqiuqDLpV2G54K+VXd7nod/zX4QMoh1xajY5uGhPVLndtHZ5zOgD6AyO3guHPJn6 N5/Q== X-Forwarded-Encrypted: i=1; AHgh+RpWlAxUILFA/f+ySqtexohBVZ2nVZvhfXVs2+9XP+l66f7t5MFSRTkL9pRdwQ2l5yFF/kJ7IGkgcA0HWrg=@vger.kernel.org X-Gm-Message-State: AOJu0YxAg4X2e7a4jGM7hqa7oYF1/7fygedFA09ZwZ/ovyqzn85dieZf fYaShDLYCF6wnHvn4dUUTCsRHGuwt3lPSfp/h0vlLiqfSzQ+iKnzXojegFwggtEsGk4= X-Gm-Gg: AR+sD13+7n/yEetdTjCFh0Ut1Cdu4uh276g7jNhlzfjIj8vy/ic3uvMMzGwWzm8Xmt3 OQoxD6T2ctSEBzr7q3xfQq/0lY9uzfNHLZqc2btnHOpSjv0te7C8+ggc5zZXCzh7B2SURDM7Xop sZ7XmU5Qb1petmkIkLNbU4kOOURHL9zboitw2x3l3oi/YBMZDVeHfMleAc7y89zzZMrUakW2qIt 9KOuSugDH05DOdjKtDPwmDUkoQllvim2qbhLwShBt/WalfvEX9rXGljZlr+e1PQKPsVi9RQbQUI TdjDOEPxZnDxeuoVb3y0z4uNbHeMnGEfSNqjLski5MMftumpzDP20STmB33JaB2UUaK+/4DZ6n4 XWW/CKkwmJv9y2RFDCfyzyYH7Ih5gtW246lRKWod5YuDXrk05iXsSga4L8rur2RpUHZ/++2SR1f 87941kX5jN07qIKGefFnmqxIJAaVQyP1c72AV/46PpmykncJbUf3w38ibZGPzwNQE= X-Received: by 2002:a05:6871:e3:b0:456:6097:168e with SMTP id 586e51a60fabf-457f2523691mr7195035fac.19.1785158161327; Mon, 27 Jul 2026 06:16:01 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:41b4:f2ef:8a0a:2104? ([2600:8803:e7e4:500:41b4:f2ef:8a0a:2104]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4581ac3f9e5sm4462997fac.6.2026.07.27.06.16.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2026 06:16:00 -0700 (PDT) Message-ID: <90018da7-8d84-4bfd-b2e1-f832ca03f764@baylibre.com> Date: Mon, 27 Jul 2026 08:15:59 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iio: light: veml3328: remove redundant cast in read_avail To: Giorgi Tchankvetadze , joshua.crofts1@gmail.com, jic23@kernel.org Cc: nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Giorgi Tchankvetadze References: <20260727112726.211344-1-giorgitchankvetadze1997@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <20260727112726.211344-1-giorgitchankvetadze1997@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/27/26 6:27 AM, Giorgi Tchankvetadze wrote: > From: Giorgi Tchankvetadze > > veml3328_scale_vals is declared as a const int array, so > veml3328_scale_vals[it_inx] already decays to const int *, > matching the type of *vals. The explicit (const int *) cast > is therefore redundant and can be dropped. > > No functional change. > > Signed-off-by: Giorgi Tchankvetadze > --- > drivers/iio/light/veml3328.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/light/veml3328.c b/drivers/iio/light/veml3328.c > index 7ff1753925c4..a3c49beee93a 100644 > --- a/drivers/iio/light/veml3328.c > +++ b/drivers/iio/light/veml3328.c > @@ -228,7 +228,7 @@ static int veml3328_read_avail(struct iio_dev *indio_dev, > return -EINVAL; > > *length = 8; > - *vals = (const int *)veml3328_scale_vals[it_inx]; > + *vals = veml3328_scale_vals[it_inx]; > *type = IIO_VAL_INT_PLUS_MICRO; > return IIO_AVAIL_LIST; > } We'll see if there are other opinions (before sending a v2)... Usually, we would declare the array like: static const int veml3328_scale_vals[4][4][2] ... in which case this cast would be needed. Currently, it is `static const int veml3328_scale_vals[4][8]` and accessed like: /* Stride by 2 through the flattened array to match (val, val2) */ *val = veml3328_scale_vals[it_inx][gain_inx * 2]; *val2 = veml3328_scale_vals[it_inx][gain_inx * 2 + 1]; Normally, we would do that like: *val = veml3328_scale_vals[it_inx][gain_inx][0]; *val2 = veml3328_scale_vals[it_inx][gain_inx][1];