From patchwork Thu May 15 08:13:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890429 Received: from clean236.mxserver.ro (clean236.mxserver.ro [46.102.249.236]) (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 9193E21773F; Thu, 15 May 2025 08:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.102.249.236 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298076; cv=none; b=OCkuSAX43dEIA4gJT27r0W28p5ESutgh5mMRfvaRVBiZDD9w6+4wZpfVFF5CgJz/QNAapf+rW9dZspRXS7QGoyiSpmRX7Js9fzMlQNeUa3+buUJ64zmKe3ICHxqcWe/KaCs6S1yRhSKx32KlkmX6Aav0VFuzBzenl4xeXfQY+TE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298076; c=relaxed/simple; bh=sbh2TgozFx82F6G8POWcV7D4BCUYqhDfLYv1kZRr97c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mYa4bMjpSHUmrp9G060h6lOMdEHwq0nOPIR1Ea+w2K8set2ODwHCVLefRR2XpdTNj4JzJKg8W17qSmM1iPZRZWlA835ditDpf9juXLhxlcVVXpi2YQhvIYV08HwO78upA/bOCCJW4G/6dJYsR7aPiwVQcDLZPFvCfGmSo6u1YkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=oZg/9LFI; arc=none smtp.client-ip=46.102.249.236 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="oZg/9LFI" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver2.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTly-001Vuu-IH; Thu, 15 May 2025 04:17:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UFB0QqKFqo4QjZyGDVXEQR2DAdpo2Z7EMAgmApIGyy8=; b=oZg/9LFIGexOaI/olQutKUJGjM 3zhKyPZnp28xMCRBMmLuUYYr9Im60xxOlEfSk62kgrAG3mkQzjJWRZfAIjWR5JyUxonfcYqrOgwp3 3qqRUT/wkjAWJZf+9bRMvkYJT+wjQ6XTZGYC9nQjjmoAWqUZvk4lhLZs3f4upuCG4D5YTi5+h9mJP nd2APBW7mPfOklJ/mj7OCvxlVrH8NChL+W7MRDwo+tV+vDXvieeu7ZFEGc34AG0tXpuCyYl36k7ys LNdJYnY61Iyi03h0lCHKQBKdZpBF3I9WI8SkJ7qan8l7i3ogfaoMgeAKcwiv1wNpEOAQ26b245CgD 337agYew==; Received: from [109.166.137.172] (port=37888 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlm-00000006q8Q-3e7Y; Thu, 15 May 2025 11:16:55 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 03/16] hwmon: ina3221: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:19 +0300 Message-ID: <20250515081332.151250-4-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00179392393933) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT8YP3XPz971hchIDSqEbakuPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNiLZt/QXQnOBRD +jq1HsIBmHTFdhqXZEtguZY7iGKpkcJnJKaJfT+dw1udmv00tbIRNtoyOobb3xnDyRRylAVTYi2b f0F0JzgUQ/o6tR7C8pLPCtTiVLo0r89ClJHDKhDGKgJ+T00JeCnHBmMdB1eMZAyYlfUtEN4pUyes jVRntA/J5DcfwvG53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9YzCFXixhwvxmPq7Q0oK0JlkJQ2noHi2tPmCjLtpYrURqjuMqXHdr/yiP gGFyxS1LuwmPRAQzaEJVYkfhZXq/u54kZVCWtfUf9oDBqtClgM5jH/om1Q6gjkapWNvVA5HRyb3X trWYR6vnFpUUmgU46LTsHtrjRqVe/ojyw7bapws3danDDsxD6gvvWu5/Lf1bKbM1VroDfVYPkwIu /8x7KhILIr1IfwgT9kxT5f4reZBSMLp/jH4zvQRYQJnl3XNqRK2lK/zP X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The ina3221_conv_time array was previously declared as u16 but used with find_closest(). With find_closest() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the array type from u16 to int to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/hwmon/ina3221.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index 1bf479a0f793..482ab8e53d5c 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -178,7 +178,7 @@ static inline int ina3221_summation_shunt_resistor(struct ina3221_data *ina) } /* Lookup table for Bus and Shunt conversion times in usec */ -static const u16 ina3221_conv_time[] = { +static const int ina3221_conv_time[] = { 140, 204, 332, 588, 1100, 2116, 4156, 8244, }; @@ -192,7 +192,7 @@ static inline u32 ina3221_interval_ms_to_conv_time(u16 config, int interval) { u32 channels = hweight16(config & INA3221_CONFIG_CHs_EN_MASK); u32 samples_idx = INA3221_CONFIG_AVG(config); - u32 samples = ina3221_avg_samples[samples_idx]; + int samples = ina3221_avg_samples[samples_idx]; /* Bisect the result to Bus and Shunt conversion times */ return DIV_ROUND_CLOSEST(interval * 1000 / 2, channels * samples); @@ -204,8 +204,8 @@ static inline u32 ina3221_reg_to_interval_us(u16 config) u32 channels = hweight16(config & INA3221_CONFIG_CHs_EN_MASK); u32 vbus_ct_idx = INA3221_CONFIG_VBUS_CT(config); u32 vsh_ct_idx = INA3221_CONFIG_VSH_CT(config); - u32 vbus_ct = ina3221_conv_time[vbus_ct_idx]; - u32 vsh_ct = ina3221_conv_time[vsh_ct_idx]; + int vbus_ct = ina3221_conv_time[vbus_ct_idx]; + int vsh_ct = ina3221_conv_time[vsh_ct_idx]; /* Calculate total conversion time */ return channels * (vbus_ct + vsh_ct); From patchwork Thu May 15 08:13:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890428 Received: from clean306.mxserver.ro (clean306.mxserver.ro [46.102.249.41]) (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 182552882CC; Thu, 15 May 2025 08:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.102.249.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298501; cv=none; b=EZWAuRxh5UKE4GssmY/zfhZUMXZo4ZTYrso6dd1iIeeao65/5Bv1cGsYYW1ggoAZzSYQpIvUhQmOgf10MEUyPGZd/9p8KPwld7sZ4+lIPzESC5h6FYjNnsVpfHVcgY9uQBsp7l1WbzwiqsTtc6J4s7fze9OIFFyc5iE1Cfz4REI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298501; c=relaxed/simple; bh=aTuWdoGv7LUb4Yp/wJTv34/q5leVNhtCtYL5kySLpqM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YLS2HG/kmQX3ODN7N0Ymj6wKBEId9nq75OmCB8is0wNbalUzvd3GnJaz2qbUVBN0q730mEN8mT6qDk7hutO1dCkb7pU4oypH/VIy6RGh/3cBi2xj7x7G4WvOVaSIpjpB7+RbyJGjM1zYF6vW4wjcXBUkHoXj9cbb58kud4a8Ppc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=ULV8Zk2b; arc=none smtp.client-ip=46.102.249.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="ULV8Zk2b" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver3.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTm1-00CMWx-8J; Thu, 15 May 2025 04:17:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5FMpxjjwSwihEUiw3F3iPHFipckrMTR33+D+UDPzc/M=; b=ULV8Zk2b+j64HWF+Fm9p5z4VxY u02aF+in0bcsAtjr9i8qPlQLFWQ931cNbPOxSKAjAQoIGZO1GPnZCadAEgOLbW++j+YxL2Qru+Tr0 +Ro2szQbFlX6bc0nECFjxJgaJ0xgA+yczRec0zWqLFw2ikb+mhVjpOckA8nOCc4v8qht/7gTcZBwm E/BX0tol6PKbwQD1R0FoD4RzsXzwf0/GzHrgToU/5VMThIvsPYCzMbpT+4+uWhYdKwtrue9TWWSsc LvR3PSrdCgi0Wv+DYrHiCsmMV+9VUJ0v1NqHTUD09h77D6aT5/iX9fEGWunxiclv7Cq7bW/i14GHN dohJCevg==; Received: from [109.166.137.172] (port=38968 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlo-00000006q9A-2Xuu; Thu, 15 May 2025 11:16:57 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 05/16] hwmon: max1619: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:21 +0300 Message-ID: <20250515081332.151250-6-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00514582746137) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9MyhWT26neQukrQep649OxPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9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DSUUd/fn3Ix/aSqJVglEtnFggTvi4y/qO0sxBxzHDeqqFz43py4SDhdaHkWkQILQXDyW9dm jNKonZjYWHRTR+H6+2RiNcUwzTu30W1RX0+3J1oiHT1UCdffPXEWaItdoEjZybQVqqiDgYguI1bG 7m9C/1crfxEQ+RMIu45TjrXtoQVWRmJMAe+fcJPd0z6bhalFEM/pjPCQA+BAlnDfxF+P4qUdmrCV Jcb6keE4kn354Ur/DPbOVK8U1h7+iyXoLo8Pd7ROcGquteNrNVAE9sdk8xREiFzSUHMNtZciSRWm 1WkKsmdoBm6E4S2NuN/NBTe2/ULqDAwOt9zqr+uO5TcDeKjrEmYPn2IVWRtXQGd2K9wEqsPdlH9+ YnMU5dPhUFL9snxfLwyUh0hPsPhVGdemay+RORAW9d0tvzdLMkCVXN63lz38Up+2UgeFcpE+PmUA j1PxNMRErSYM7n8DxBG3VLDRB+maCRTs466AUT31X+L1qXgiXZeLdQiA X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The update_intervals array was previously declared as u16 but used with find_closest_descending(). With find_closest_descending() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the array type from u16 to int to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/hwmon/max1619.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 9b6d03cff4df..0bd9fbb2517c 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c @@ -103,7 +103,7 @@ static int max1619_temp_read(struct regmap *regmap, u32 attr, int channel, long return 0; } -static u16 update_intervals[] = { 16000, 8000, 4000, 2000, 1000, 500, 250, 125 }; +static int update_intervals[] = { 16000, 8000, 4000, 2000, 1000, 500, 250, 125 }; static int max1619_chip_read(struct regmap *regmap, u32 attr, long *val) { From patchwork Thu May 15 08:13:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890422 Received: from clean64.mxserver.ro (clean64.mxserver.ro [89.44.139.64]) (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 EB5EC28C843; Thu, 15 May 2025 08:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.44.139.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299376; cv=none; b=N2PHlS4nTQKsJc7Z+2Dkla3xjBKotybFxHwgR8k7hcGYleV/UPpy9scE+lQI95hx5n1Y6mJQRO6vUmz7nO1yVIxVcoEf5/f9Di61gHKOMhwk5aKxu/DPwftNXj9WhaY7+SqMNeEIXtA9U4hqqiGW1gcgYnVlsaSP+3DLyWtQHR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299376; c=relaxed/simple; bh=N8j4I4fkFCpIkznTeW9ldkHUN3alnXsC8Jw3boo96ag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RlF/k+FBcPk6F0ccLaKHo4Ewv8vJCdDo+x+bQaqNcFhSgUaWe+3/SUxReU9xMkg8EYRBJzEuHpjPQtOnkV637RoikhX/S9ilIYVRbNjJfo482y9toEmxp4LEt4YQgqUEKmISFfwBQiMvKPPdpIa0t12Il8G+ZjXDCifW9bf9tyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=o2970clG; arc=none smtp.client-ip=89.44.139.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="o2970clG" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver2.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTm1-001Vxp-7f; Thu, 15 May 2025 04:17:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UUMeAh+/oO9zW+np+bm56HwIJA0Jn1VWd8Ucu5fYOxw=; b=o2970clGp6SX2iHSkiqWq4Fm2C YncD8/clKBN6Zz8Bl0r501793xsP2X3pn3mNu/zICtu9228CxLEfOZKZcMnK79u/HqQfhbmubjTqn CaAXp/bcFfOvbST12s3spEJW9vtZEvmQSSkDXdWXiT1jhc+mf4aa3ZZohojoUiCXlFoRUm2XaS9t+ STmLNt3r1EwGhZTh0nqPdWMFI9/JIGJuUnUlBNvDLiQ0MmNSbFQ0oPZ15l6hvmaZd1gBgEKQ/q7Wi Od2X+yIGGFKFVGtkmKulF3jWn4+RkM2VllYoa0dSTTPH1I8SFZQgXMRmw/nA4b1ufv06esje/3YSv qQem1twQ==; Received: from [109.166.137.172] (port=38974 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlp-00000006q9o-2C7u; Thu, 15 May 2025 11:16:58 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 06/16] hwmon: lm75: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:22 +0300 Message-ID: <20250515081332.151250-7-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00944947725381) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9FfpFOLnuHlwgr/64pwLjPPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNiLZt/QXQnOBRD +jq1HsIBmHTFdhqXZEtguZY7iGKpkcJnJKaJfT+dw1udmv00tbIRNtoyOobb3xnDyRRylAVTYi2b f0F0JzgUQ/o6tR7C8pLPCtTiVLo0r89ClJHDKhDGKgJ+T00JeCnHBmMdB1eMZAyYlfUtEN4pUyes jVRntA/J5DcfwvG53FyVviDO9UET3GKmqv1jT0lY+AQz8YX4C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jzFRaJdtHxap1B2hSHfH7uFr/yiP gGFyxS1LuwmPRAQzaEJVYkfhZXq/u54kZVCWtfUf9oDBqtClgM5jH/om1Q6gjkapWNvVA5HRyb3X trWYR6vnFpUUmgU46LTsHtrjRqVe/ojyw7bapws3danDDsxD6gvvWu5/Lf1bKbM1VroDfVYPkwIu /8x7KhILIr1IfwgT9kxT5f4reZBSMLp/jH4zvQRYQJnl3XNqRK2lK/zP X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The default_sample_time and sample_times members of lm75_params were previously declared as unsigned int but used withfind_closest(). With find_closest() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the types from unsigned int and unsigned int* to int respectively int* to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/hwmon/lm75.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index d95a3c6c245c..5c835ee189d4 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -89,9 +89,9 @@ struct lm75_params { u8 default_resolution; u8 resolution_limits; const u8 *resolutions; - unsigned int default_sample_time; + int default_sample_time; u8 num_sample_times; - const unsigned int *sample_times; + const int *sample_times; bool alarm; }; @@ -110,7 +110,7 @@ struct lm75_data { struct regmap *regmap; u16 orig_conf; u8 resolution; /* In bits, 9 to 16 */ - unsigned int sample_time; /* In ms */ + int sample_time; /* In ms */ enum lm75_type kind; const struct lm75_params *params; u8 reg_buf[1]; @@ -139,7 +139,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 125, .num_sample_times = 4, - .sample_times = (unsigned int []){ 125, 250, 1000, 4000 }, + .sample_times = (int []){ 125, 250, 1000, 4000 }, .alarm = true, }, [at30ts74] = { @@ -147,7 +147,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 200, .num_sample_times = 4, - .sample_times = (unsigned int []){ 25, 50, 100, 200 }, + .sample_times = (int []){ 25, 50, 100, 200 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [ds1775] = { @@ -156,7 +156,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 11, .default_sample_time = 500, .num_sample_times = 4, - .sample_times = (unsigned int []){ 125, 250, 500, 1000 }, + .sample_times = (int []){ 125, 250, 500, 1000 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [ds75] = { @@ -165,7 +165,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 11, .default_sample_time = 600, .num_sample_times = 4, - .sample_times = (unsigned int []){ 150, 300, 600, 1200 }, + .sample_times = (int []){ 150, 300, 600, 1200 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [stds75] = { @@ -174,7 +174,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 11, .default_sample_time = 600, .num_sample_times = 4, - .sample_times = (unsigned int []){ 150, 300, 600, 1200 }, + .sample_times = (int []){ 150, 300, 600, 1200 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [stlm75] = { @@ -186,7 +186,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 200, .num_sample_times = 4, - .sample_times = (unsigned int []){ 25, 50, 100, 200 }, + .sample_times = (int []){ 25, 50, 100, 200 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [g751] = { @@ -227,13 +227,13 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 55, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, }, [pct2075] = { .default_resolution = 11, .default_sample_time = MSEC_PER_SEC / 10, .num_sample_times = 31, - .sample_times = (unsigned int []){ 100, 200, 300, 400, 500, 600, + .sample_times = (int []){ 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100 }, @@ -245,7 +245,7 @@ static const struct lm75_params device_params[] = { .resolution_limits = 9, .default_sample_time = 240, .num_sample_times = 4, - .sample_times = (unsigned int []){ 30, 60, 120, 240 }, + .sample_times = (int []){ 30, 60, 120, 240 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp100] = { @@ -254,7 +254,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 320, .num_sample_times = 4, - .sample_times = (unsigned int []){ 40, 80, 160, 320 }, + .sample_times = (int []){ 40, 80, 160, 320 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp101] = { @@ -263,7 +263,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 320, .num_sample_times = 4, - .sample_times = (unsigned int []){ 40, 80, 160, 320 }, + .sample_times = (int []){ 40, 80, 160, 320 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp105] = { @@ -272,7 +272,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 220, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp112] = { @@ -282,7 +282,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 125, .num_sample_times = 4, - .sample_times = (unsigned int []){ 125, 250, 1000, 4000 }, + .sample_times = (int []){ 125, 250, 1000, 4000 }, .alarm = true, }, [tmp175] = { @@ -291,7 +291,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 220, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp275] = { @@ -300,7 +300,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 220, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp75] = { @@ -309,14 +309,14 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 220, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, .resolutions = (u8 []) {9, 10, 11, 12 }, }, [tmp75b] = { /* not one-shot mode, Conversion rate 37Hz */ .clr_mask = 1 << 7 | 3 << 5, .default_resolution = 12, .default_sample_time = MSEC_PER_SEC / 37, - .sample_times = (unsigned int []){ MSEC_PER_SEC / 37, + .sample_times = (int []){ MSEC_PER_SEC / 37, MSEC_PER_SEC / 18, MSEC_PER_SEC / 9, MSEC_PER_SEC / 4 }, .num_sample_times = 4, @@ -331,7 +331,7 @@ static const struct lm75_params device_params[] = { .default_resolution = 12, .default_sample_time = 28, .num_sample_times = 4, - .sample_times = (unsigned int []){ 28, 55, 110, 220 }, + .sample_times = (int []){ 28, 55, 110, 220 }, } }; From patchwork Thu May 15 08:13:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890427 Received: from clean134.mxserver.ro (clean134.mxserver.ro [185.92.194.134]) (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 96B5E1F461A; Thu, 15 May 2025 08:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.92.194.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298579; cv=none; b=GBRjPReOEK7efjydxI/tauJSXi0GeFFhjmaOHfkE/2px0AeG3bRxSzWTWaV5TDbwzvWEQkisYXH99TYmmJLxTd8+fRVv0KXOCQNEGnGID5ZjhXGVYES6IST0/aphdzrOybGaUMNl+dFmSl7bMPR/ArZLUjvyxiYVmywIWZ21v/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747298579; c=relaxed/simple; bh=i/vzRKjxd8txmhCKxwejRYetCVU9QJNjyjUjOeXWCwM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WSVjC0MMLglxFcjcyF9tlE8nmRr7LaLZ+wHuiqDyRB7XlLh+qJT24R1S9Nz0TEBOgLVLGGXOzAKQ5IopsJprz+qkpVwC/kaTEHn6cucg5agxxJ8kgWQu8Cby/mBGA7YTs/6H21oS2wx8J40Hdb0lxkn/CxsNdwQQt9HvDPu5Pok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=e9fM/j4t; arc=none smtp.client-ip=185.92.194.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="e9fM/j4t" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver3.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTm2-00CMaz-40; Thu, 15 May 2025 04:17:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vHKKhlosxKGDbCAuvxtDbDAGGL1kot1tdpFPo/6AsYU=; b=e9fM/j4ta67Put5ZPL+/Q9lpHf jYZVJkKQOg3xP9mDpPgatmKWHaFrawhnSpGBN32jaa8H4KDo4JEAx4CBVPkyFW0HkaOUIXF6N/1DC bdAZ7uF/EeGj7s7wW8yot8lKhH4cTKBkHlYCbvTo1ldGxXEHiEgTkRGtkSEZcR2zXcBXu3ZMp5sqC SX64YrLGGsxETnXFODDe7yiWdWCipI0bAdHrdcNjLqnjQlAMCq+abFVyqkX2F2eHdnSguD6qzHTCf JS1dA2Zzctiv/J/DoGXxOf55/QmGRgUJuYISeNcho6v66OL+1EefkQFwtqbikuGfkfsmDOveZ9HOn Y4AyJKSQ==; Received: from [109.166.137.172] (port=38998 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlr-00000006qAi-18NQ; Thu, 15 May 2025 11:17:00 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 08/16] hwmon: max6639: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:24 +0300 Message-ID: <20250515081332.151250-9-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00945865962282) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT8dAJjXAj4NfW1oK4/8ICdkPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNiLZt/QXQnOBRD +jq1HsIBmHTFdhqXZEtguZY7iGKpkcJnJKaJfT+dw1udmv00tbIRNtoyOobb3xnDyRRylAVTYi2b f0F0JzgUQ/o6tR7C8pLPCtTiVLo0r89ClJHDKhDGKgJ+T00JeCnHBmMdB1eMZAyYlfUtEN4pUyes jVRntA/J5DcfwvG53FyVviDO9UET3GKmqv1jT0lY+AQz8YX4CVph7ctC7tRH2SPTQJ/0klTuXKq/ B9rqRWsYzNfBLt79i78aPHyWnIqxGMxPZotYvH/es1vXuByXo2bkrYMqq0x5CzaUoJIoBUQayHle UvbvCQmh9x4kn6NeQcRkc6G+OgAcq5x+BzhRyg9rYO6I0H7Q2OEpckvWJAOmdJd77Z9vwc+QHB+X +u7aTqYHtT2CBuxNPBc9JM2jck1NnIBf0tvflhq7Xjhll72AYgnW/6M0ftSpvLIx+X1vKami8KF6 jWQ71uVNIY/EFPWeDmcZuFRQy1vmjjPiYw8fUCp0/qY6cmSW9oUDdvKuTRfTGZ6f8nTXoYFaQ71l mMti8uxA0gKVmIzBXtbLDVvAQ/KVNYAgpWt+qkyDk8+YD4ob/42SAN5VcIfsMVILjVAz6RZsCHxD lgOJwEwCFaF+62b2lf1UUDu9jECN1V/lwmsioRK+Y6c+J2XawkXUwNqmNMJsXAQw85DCXa0iAPEd fYyrF5wMRSLGyY+i0m2IxQLxQUz5rOsCgWfUk8oCCEJC9L2lSDBPqdRoFsq0hfzdx0oxkgNI/jhY WFhu7VV+HdWjdZLlmQ5z83qEVVG/6RJ+BW7FmGcwL889DSW2cZWGkIYVQAbHnYkWUz1gRIjAiMvi vM7um7t0SVa5NVZ2g1u6DnOpqk1nwAzTSgytNKIH5lfAuQc8I07FTFcjpdfX/Jcr87en7cKbI0NU afdkQMG+6qjtXoANVR89VM6f75a5kmRIbungV7ywXD8VtmM8wef5C6IkqMFhROX1HYRo9Sm1kZOW saz62DSUUd/fn3Ix/aSqJVglEtnFggTvi4y/qO0sxBxzHDeqqFz43py4SDhdaHkWkQILQXDyW9dm jNKonZjYWHRTR+H6+2RiNcUwzTu30W3Ni3ZF+6ZH9NeE92ciAHcfaItdoEjZybQVqqiDgYguI1bG 7m9C/1crfxEQ+RMIu45TjrXtoQVWRmJMAe+fcJPd0z6bhalFEM/pjPCQA+BAlnDfxF+P4qUdmrCV Jcb6keE4kn354Ur/DPbOVK8U1h7+l92l2DfNCecwYAX//Yb5bTrhhFdNH2fNvCBVKgCCAeEiSRWm 1WkKsmdoBm6E4S2NuN/NBTe2/ULqDAwOt9zqr+uO5TcDeKjrEmYPn2IVWRtXQGd2K9wEqsPdlH9+ YnMU5dPhUFL9snxfLwyUh0hPsPhVGdemay+RORAW9d0tvzdLMkCVXN63lz38Up+2UgeFcpE+PmUA j1PxNMRErSYM7n8DxBG3VLDRB+maCRTs466AUT31X+L1qXgiXZeLdQiA X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The freq_table array was previously declared as unsigned int but used with find_closest(). With find_closest() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the array type from unsigned int to int to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/hwmon/max6639.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index 32b4d54b2076..b6942b406880 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c @@ -63,7 +63,7 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END }; static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; /* Supported PWM frequency */ -static const unsigned int freq_table[] = { 20, 33, 50, 100, 5000, 8333, 12500, +static const int freq_table[] = { 20, 33, 50, 100, 5000, 8333, 12500, 25000 }; #define FAN_FROM_REG(val, rpm_range) ((val) == 0 || (val) == 255 ? \ From patchwork Thu May 15 08:13:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890425 Received: from clean306.mxserver.ro (clean306.mxserver.ro [46.102.249.41]) (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 3A38A28C849; Thu, 15 May 2025 08:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.102.249.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299020; cv=none; b=oSqSn3E6cK2SEOeZPWS3wJiVXy2SWct1WwAGS+Jd+oSt3ADbKwUV8sQm/uIb6y4qtUkLcTSxcxacYrUU9yALpnibqo8oLk8OWeuVv0jRjtki1UXx4wqKdc4e/eRv/mftyRrgedJ/8q2+Uci4LQOzNyHlC7rrFHL07u4KLDpQVgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299020; c=relaxed/simple; bh=UrsXN5BvsiqE04f7YeDfQT3UuNVswVmTBvR9lCi358Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QbBeVIo/Ry0jGz8gmfKbFWpZXTgD2Se5tsdv9yl6W7cf8Y/Dd9I8QE/qt2STtKXZfbGNIBoo9azCH+mdbaKGiCWlkcTxtcWnqDzxeU+kpOjHPfK4k9GwhEWZ1UIBtKhU4oQDQzcDW+73WU+ifiyK3YJn3xdZ974W6CH/1LcZN8k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=IOFKTbyL; arc=none smtp.client-ip=46.102.249.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="IOFKTbyL" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver3.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTm5-00CMeD-05; Thu, 15 May 2025 04:17:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Dd/1uGlxOGQIWLy+UQQMfzF+0rkvA0dOH5y9zGsb3zc=; b=IOFKTbyLNpmAaSCGKgbdGUACMy QLyJvOxILHppGYla0i7JPpcYcC/MTnxS1UiLI/6yAabY5k0zQjcHmiFY1Dp8vF5Qgna/mmjZSNZtS 2E3QPHXZxioGcaBINNmCkUigXU/2IJCeSmwh9lyDKbh3ljERZgo/3fKlD11u6m0ZPZeGq4nW9o7SI VhBGldBnTT7eCEt6czKy3/Fl3G6bF3gm9Hdb6hEKWIm71tgwwp6ufmDEq428nHRN1V+r3ql/peWvz KZ5EgMTh2q1C8OUGDV2t1v41cx49lhtAoyvGrOaUVNSwdo76hO8BpfEPiTRzw7riNXzkD0jiLW7je eA/K0j9g==; Received: from [109.166.137.172] (port=39036 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlu-00000006qHm-0oO8; Thu, 15 May 2025 11:17:03 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 11/16] iio: mcp3564: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:27 +0300 Message-ID: <20250515081332.151250-12-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00594371703284) X-Rec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kIYVQAbHnYkWUz1gRIjAiMvi vM7um7t0SVa5NVZ2g1u6DnOpqk1nwAzTSgytNKIH5lfAuQc8I07FTFcjpdfX/Jcr87en7cKbI0NU afdkQMG+6qjtXoANVR89VM6f75a5kmRIbungV7ywXD8VtmM8wef5C6IkqMFhROX1HYRo9Sm1kZOW saz62DSUUd/fn3Ix/aSqJVglEtnFggTvi4y/qO0sxBxzHDeqqFz43py4SDhdaHkWkQILQXDyW9dm jNKonZjYWHRTR+H6+2RiNcUwzTu30W3aAMyZU+AFpdcwj1rCWKtoaItdoEjZybQVqqiDgYguI1bG 7m9C/1crfxEQ+RMIu45TjrXtoQVWRmJMAe+fcJPd0z6bhalFEM/pjPCQA+BAlnDfxF+P4qUdmrCV Jcb6keE4kn354Ur/DPbOVK8U1h7+CQ9zHshHNhAtXYb18nfCRRlJFBHB+of+uXRa0S3mFIoiSRWm 1WkKsmdoBm6E4S2NuN/NBTe2/ULqDAwOt9zqr+uO5TcDeKjrEmYPn2IVWRtXQGd2K9wEqsPdlH9+ YnMU5dPhUFL9snxfLwyUh0hPsPhVGdemay+RORAW9d0tvzdLMkCVXN63lz38Up+2UgeFcpE+PmUA j1PxNMRErSYM7n8DxBG3VLDRB+maCRTs466AUT31X+L1qXgiXZeLdQiA X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The mcp3564_oversampling_avail array was previously declared as unsigned int but used with find_closest(). With find_closest() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the arrays type from unsigned int to int to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/iio/adc/mcp3564.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c index a68f1cd6883e..01efc77f710a 100644 --- a/drivers/iio/adc/mcp3564.c +++ b/drivers/iio/adc/mcp3564.c @@ -253,7 +253,7 @@ enum mcp3564_oversampling { MCP3564_OVERSAMPLING_RATIO_98304 }; -static const unsigned int mcp3564_oversampling_avail[] = { +static const int mcp3564_oversampling_avail[] = { [MCP3564_OVERSAMPLING_RATIO_32] = 32, [MCP3564_OVERSAMPLING_RATIO_64] = 64, [MCP3564_OVERSAMPLING_RATIO_128] = 128, From patchwork Thu May 15 08:13:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890424 Received: from clean103.mxserver.ro (clean103.mxserver.ro [176.223.125.170]) (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 5F7042949F9; Thu, 15 May 2025 08:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.223.125.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299133; cv=none; b=CdLvXfC7jLBVM3xPnmw86pAhzDWDdk1ftxcm3U4Pd6cz7FaR7UP8OZFKXaTdtBrZe+NoPdr1weAFw8/Y1c5c9vLrW8t+JeiLWRm0f+wKs7Iq3g3iKBarB3IupxuUu4bNGsMUUlJqlOSBhxMEjjJPZxNwbfRZ4+FCuA0h0MuBHi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299133; c=relaxed/simple; bh=q/hTLxGkevrKMP4/fm1sZBbPK6IIoosv/EPhSqzLYSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bnhyiIM/5nOJqKCztLqClJVyaCmFjxhDKdaEGV2k5pQ1WBxRz1aDdC6wlXKjQCh3Yv0YShTwqKS2M3zx8XiJV5ZXqmt5kwEEcuI+mHyvNX2e4E2E7IB4bPufOepJ/1wd5bcJ+VeyakpiozjaT+bDQ53n6Md8l2t0y14kwDk8WFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=I5GISWNL; arc=none smtp.client-ip=176.223.125.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="I5GISWNL" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver1.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTm5-00H1Ro-65; Thu, 15 May 2025 04:17:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=koakyKDUeUIeXFkt5kHFcp8R9b8v4EKGe5vzuuktP7U=; b=I5GISWNLK58PKla/LyJdEMylzb pnP5NkUlRT1ZxS0cdp67LfIcRRV9pkS2JRrg1B9np0hpEU90qPExPVJck7HACbC0P21pKzfn95JvD iiJmRVa6Qtj/X2PP24tJr/JcXtaicxxKbfQW1Nw6I7gCL66WHBdX9k2Q9GDv915sM4WAqXdxumagh vzBUTzS8oNgaY9awb/miMx2SX8+Kn3W/43KA1KPzOfS+05huC60U0Gs6fvnkEaBmO2zB+/6Csi3xW fLBhE29dkoUzDBtALBhlQe6WauOdpgVtc6Vp0Jdzek5ai4JrYNjUQGeEa9ILM+PaYABztHTb/HHOe HsT64JgA==; Received: from [109.166.137.172] (port=39050 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTlv-00000006qIN-0WJA; Thu, 15 May 2025 11:17:04 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 12/16] iio: max44009: Fix type incompatibility with non-macro find_closest Date: Thu, 15 May 2025 11:13:28 +0300 Message-ID: <20250515081332.151250-13-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00920917721819) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9LmVb6q1/FaccTvM3orKErPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNi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d2 sh7IKZpXLgBCJ476nn5Gmr/PK603nEEtNszXdIHFite8wCT/ojMvxJYqN+GmyxwR+V15PgePOPPI vtB/lrJsWW29FRnUbXCk3//yGA2OaEkyEoP0Kl1YERWeKKG4PAQYNyavp7c49JwbmBalBK3QvTzZ aymz/kAx9sNOIdFDvUNZLdaRhCZanVD8rWRXHFnkJJ9VGpuX4LTQYyCuF2Axy3+5ga4Wzl9Zj2VA 3aW/vPi2AMAbWLs/EIKEbeDIxNYIJ7Ews1OEan6m+UeFXprlCOm3BAEbJtATHIdhc/Osc/lXM+l8 06U7GxUAPGlXms+D1TI22+vIvtmOpB8mDzWv8vBwVi5XkC8ewLVRqANj6mzlzL3VH5WM/aCyI5/o yhoezeIJy3L+cB4hBppwR1r+Bof9KZqCMQkUV4VT4TerS/vbL3R5w07g X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The max44009_int_time_ns_array array was previously declared as u32 but used with find_closest(). With find_closest() now implemented as a function taking signed int parameters instead of a macro, passing unsigned arrays causes type incompatibility errors. This patch changes the arrays type from u32 to int to ensure compatibility with the function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/iio/light/max44009.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/max44009.c b/drivers/iio/light/max44009.c index 8cd7f5664e5b..d274224fc210 100644 --- a/drivers/iio/light/max44009.c +++ b/drivers/iio/light/max44009.c @@ -55,7 +55,7 @@ /* The fixed-point fractional multiplier for de-scaling threshold values */ #define MAX44009_FRACT_MULT 1000000 -static const u32 max44009_int_time_ns_array[] = { +static const int max44009_int_time_ns_array[] = { 800000000, 400000000, 200000000, From patchwork Thu May 15 08:13:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890423 Received: from clean202.mxserver.ro (clean202.mxserver.ro [89.46.7.114]) (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 082EF1ADFFE; Thu, 15 May 2025 08:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.46.7.114 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299230; cv=none; b=VZdl+Y++jahwozZtIXgh9mBVoD7+K9ZNIGXOrP+7v+ALT59WD2vobQkaGNbUMLdaBwn9cK7Zaj9e0N+kAo4AwqeKUMARpomW7ZUbgdQqyBxG1oJ8hT4uTzSfZ+vwEsu5WgvZYnIA7DT857Q4UFuMrTBmRrDr6Xg3IeehEcM4FX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747299230; c=relaxed/simple; bh=qaN3sNCyLFEQxYt6b3T2rChPKqYchJ51Y/kaeDzdX7s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HmX3InJc6Ll7WLiY0CZMbifjkxVViHtjraMNAXbMfXCpgtJBH0TIZS3cD5D6smtPYpK6RmS03/+a67onhtiRv0uxWOSdQP5pHv92VG14oHUAQmR6Z1sfXAiuZbtqvxII7MDa6maYPkL5KXU0Bmt58+ke0/2TUkwrUTQJSNw1RPI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=HCTxtc1U; arc=none smtp.client-ip=89.46.7.114 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="HCTxtc1U" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver2.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTmD-001W8f-9v; Thu, 15 May 2025 04:17:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Tf84gVqj0tGGaREDsyyKj4PxnmF+1JNB072X3oHVgkA=; b=HCTxtc1U1gQ0c+BKWNG3vGyjBW awwWM0fmrlmfTEKtVjTy9Hczk+h8PBIOPwkBowqxpHSz24ye/lIXddJcMgkfKreGXCZhkadBWF9DK 2xVFLjAAmLSLp6B5e4GcLwffRYVDC8QBR20DpoO1qHuX9ImkMTVW783wEo2vMjKpo/K1cvuxB7uc5 f5euZWIjV+EU4/cIIvfvWzSi8QPlnUZF/7dt0uMMvHCR5RV4hJUdXoN00KyhwRh87YJD4vV+f7AVp zt1lVlIEFjlVhHeRBBlvGrqt+Ar3sBJej6chfvbNbziSfAA86hIwq/v8w0qvq5TZuejdQz1am5+/F TuH6hxrA==; Received: from [109.166.137.172] (port=55928 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTm1-00000006qLV-1PG1; Thu, 15 May 2025 11:17:10 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 15/16] watchdog: simatic-ipc-wdt: Fix type incompatibility with find_closest() Date: Thu, 15 May 2025 11:13:31 +0300 Message-ID: <20250515081332.151250-16-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.01) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9JEhNQgksodpkE3SFzsKIFPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNiLZt/QXQnOBRD +jq1HsIBmHTFdhqXZEtguZY7iGKpkcJnJKaJfT+dw1udmv00tbIRNtoyOobb3xnDyRRylAVTYi2b f0F0JzgUQ/o6tR7C8pLPCtTiVLo0r89ClJHDKhDGKgJ+T00JeCnHBmMdB1eMZAyYlfUtEN4pUyes jVRntA/J5DcfwvG53FyVviDO9UET3GKmqv1jT0lY+AQz8YX4CVph7ctC7tRH2SPTQJ/0klTuXKq/ B9rqRWsYzNfBLt79i78aPHyWnIqxGMxPZotYvH/es1vXuByXo2bkrYMqq0x5CzaUoJIoBUQayHle UvbvCQmh9x4kn6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O1ghGh/DUNuB/g2OV987SVK+CeGpRwqUJT500pacqW637mIaQpIIazbKBmghZMypFVNg9 0N7182QNMEbAtB23JpYTnB2HqfPoGtp9xnk= X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro The wd_timeout_table array was previously declared as unsigned int but used with find_closest(), which takes signed int parameters. Change this array from unsigned int to int to maintain type compatibility with the find_closest() function signature and prevent compilation errors. Signed-off-by: Alexandru Soponar --- drivers/watchdog/simatic-ipc-wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c index 1e91f0a560ff..36c68d2ed409 100644 --- a/drivers/watchdog/simatic-ipc-wdt.c +++ b/drivers/watchdog/simatic-ipc-wdt.c @@ -59,7 +59,7 @@ static struct resource io_resource_trigger = static struct resource mem_resource = DEFINE_RES_MEM_NAMED(0, 0, "WD_RESET_BASE_ADR"); -static u32 wd_timeout_table[] = {2, 4, 6, 8, 16, 32, 48, 64 }; +static int wd_timeout_table[] = {2, 4, 6, 8, 16, 32, 48, 64 }; static void __iomem *wd_reset_base_addr; static int wd_start(struct watchdog_device *wdd) From patchwork Thu May 15 08:13:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Soponar X-Patchwork-Id: 890433 Received: from clean103.mxserver.ro (clean103.mxserver.ro [176.223.125.170]) (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 251F22874F6; Thu, 15 May 2025 08:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.223.125.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747297048; cv=none; b=XTqIKe4qnuIAai7EXUWnWAX/aiMmTf5nTSvqGIzRCBHOsFC5pMKKsdJVrj0HB9UGSFv/N6Xx4BOlV9iU/qYeICkayRz/HRWywq0OoFgE6KjMAukA5DgtNxyJKSgukSB9LIbEorUyvKhhO2fWvrgMQnOszehL8vSoDhNxKsxYCpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747297048; c=relaxed/simple; bh=59EvuJKTItg/MQf3XkZzL1WEDvsOtpA/YLaURewi72g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SYPIwsCLWj0W6J99xTF6Qoo77EN0ru72AvIxq4SnyCHfNa3kKDROyygwLlpnKAKJOwkiqpPwCmnO35DcY+xYq/3CB35abvpCLezcO3uGwN7WkfgMJZgfG93r+LgxNa3daTF6og+OxUqYuSZroVo+4cDJ79hGs4aORIhE8n3TRg8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro; spf=pass smtp.mailfrom=taladin.ro; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b=KRYbtfwK; arc=none smtp.client-ip=176.223.125.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=taladin.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=taladin.ro Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=taladin.ro header.i=@taladin.ro header.b="KRYbtfwK" Received: from cloud347.c-f.ro ([185.236.86.218]) by cleanserver1.mxserver.ro with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uFTmD-00H1kv-CP; Thu, 15 May 2025 04:17:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=taladin.ro; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5qQNra+2Cp8u7mp46CFqnKOn4bpY4tOymWLSppXXVgQ=; b=KRYbtfwKrP5JWyHDZyJ+LsM4TM ko5g12ztP9SwDdjndz/buqYuuXqDtqQKnyiflgq1UFxBOSmPhitIHUzGy7mnvtCpjhWfUFb4HS/tJ 42duJd6hAlw30bu+iN8P2nlho9hCXMaOZRAr2n5UDKEXPuNynFscveZyrfzzFXNsIFO/7gD3iA8ah 6q5P4UCrT4W51CgWGbrMQt8l9K9UUD2b/O4TrMOVwzdr+cCYBeOKx827YWv6uPZdNtR9lu9Yeznpo xU4hKjixEQ3bnAo/kHGe6LBvh3j5b4IDagHVH4teVi4MqB7Pq1UaomwKl/5hiUEDLeyiDWHRT5TNA UTH0G8mA==; Received: from [109.166.137.172] (port=55940 helo=localhost) by cloud347.c-f.ro with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uFTm3-00000006qMV-1X5D; Thu, 15 May 2025 11:17:12 +0300 From: Alexandru Soponar To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, jic23@kernel.org, pavel@ucw.cz, lee@kernel.org, baocheng.su@siemens.com, wim@linux-watchdog.org, tobias.schaffner@siemens.com, angelogioacchino.delregno@collabora.com, benedikt.niedermayr@siemens.com, matthias.bgg@gmail.com, aardelean@baylibre.com, contact@sopy.one, Alexandru Soponar Subject: [PATCH 16/16] lib: move find_closest() and find_closest_descending() to lib functions Date: Thu, 15 May 2025 11:13:32 +0300 Message-ID: <20250515081332.151250-17-asoponar@taladin.ro> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515081332.151250-1-asoponar@taladin.ro> References: <20250515081332.151250-1-asoponar@taladin.ro> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SpamExperts-Domain: cloud347.c-f.ro X-SpamExperts-Username: 185.236.86.218 Authentication-Results: mxserver.ro; auth=pass smtp.auth=185.236.86.218@cloud347.c-f.ro X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.000242666053139) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT98ZpYtbjLMlHLIMLfKiMBSPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5w1OL79HMxE022P+rQy8YAdcSeERs4TOTnIH1kc1IWc5TSx S75yz9IFZiY7BarU/NrpK8SEOwGmfn6ucAKqn/OHRh3BqzFaEnAEj4UixLJBjVNiLZt/QXQnOBRD +jq1HsIBmHTFdhqXZEtguZY7iGKpkcJnJKaJfT+dw1udmv00tbIRNtoyOobb3xnDyRRylAVTYi2b f0F0JzgUQ/o6tR7C8pLPCtTiVLo0r89ClJHDKhDGKgJ+T00JeCnHBmMdB1eMZAyYlfUtEN4pUyes jVRntA/J5DcfwvG53FyVviDO9UET3GKmqv1jT0lY+AQz8YX4CVph7ctC7tRH2SPTQJ/0klTuXKq/ B9rqRWsYzNfBLt79i78aPHyWnIqxGMxPZotYvH/es1vXuByXo2bkrYMqq0x5CzaUoJIoBUQayHle UvbvCQmh9x4kn6NeQcRkc6G+OgAcq5x+BzhRyg9rYO6I0H7Q2OEpckvWJAOmdJd77Z9vwc+QHB+X +u7aTqYHtT2CBuxNPBc9JM2jck1NnIBf0tvflhq7Xjhll72AYgnW/6M0ftSpvLIx+X1vKami8KF6 jWQ71uVNIY/EFPWeDmcZuFRQy1vmjjPiYw8fUCp0/qY6cmSW9oUDdvKuTRfTGZ6f8nTXoYFaQ71l mMti8uxA0gKVmIzBXtbLDVvAQ/KVNbF0n38s4PnjIiWSgo0iehuSAN5VcIfsMVILjVAz6RZsCHxD lgOJwEwCFaF+62b2lf1UUDu9jECN1V/lwmsioRLmNJoHOZOE/9e5UD715p61XAQw85DCXa0iAPEd fYyrF5wMRSLGyY+i0m2IxQLxQUxLMkCVXN63lz38Up+2UgeFSDBPqdRoFsq0hfzdx0oxkgNI/jhY WFhu7VV+HdWjdZLlmQ5z83qEVVG/6RJ+BW7FmGcwL889DSW2cZWGkIYVQAbHnYkWUz1gRIjAiMvi vM7um7t0SVa5NVZ2g1u6DnOpqk1nwAzTSgytNKIH5lfAuQc8I07FTFcjpdfX/Jcr87en7cKbI0NU afdkQMG+6qjtXoANVR89VM6f75a5kmRIbungV7ywXD8VtmM8wef5C6IkqMFhROX1HYRo9Sm1kZOW saz62DSUUd/fn3Ix/aSqJVglEtnFggTvi4y/qO0sxBxzHDeqqFz43py4SDhdaHkWxEWqfohU+1d2 sh7IKZpXLgBCJ476nn5Gmr/PK603nEEgvmn7Dzq8wsrwxhZMoHvqxJYqN+GmyxwR+V15PgePOPPI vtB/lrJsWW29FRnUbXCk3//yGA2OaEkyEoP0Kl1YERWeKKG4PAQYNyavp7c49JwbmBalBK3QvTzZ aymz/kAx9sNOIdFDvUNZLdaRhCZaMx8xtwV1+Gg8ihl6LJV8o3nXKu/l5TM8iMLe4AKyoGlZj2VA 3aW/vPi2AMAbWLs/EIKEbeDIxNYIJ7Ews1OEan6m+UeFXprlCOm3BAEbJtATHIdhc/Osc/lXM+l8 06U7GxUAPGlXms+D1TI22+vIvtmOpB8mDzWv8vBwVi5XkC8ewLVRqANj6mzlzL3VH5WM/aCyI5/o yhoezeIJy3L+cB4hBppwR1r+Bof9KZqCMQkUV4VT4TerS/vbL3R5w07g X-Report-Abuse-To: spam@cleanserver1.mxserver.ro X-Complaints-To: abuse@cleanserver1.mxserver.ro Move the utility macros find_closest() and find_closest_descending() from inline macros to proper library functions in lib/. Signed-off-by: Alexandru Soponar --- include/linux/find_closest.h | 13 +++++++ include/linux/util_macros.h | 61 +------------------------------ lib/Makefile | 2 +- lib/find_closest.c | 71 ++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 61 deletions(-) create mode 100644 include/linux/find_closest.h create mode 100644 lib/find_closest.c diff --git a/include/linux/find_closest.h b/include/linux/find_closest.h new file mode 100644 index 000000000000..28a5c4d0c768 --- /dev/null +++ b/include/linux/find_closest.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Find closest element functions + */ +#ifndef _LINUX_FIND_CLOSEST_H_ +#define _LINUX_FIND_CLOSEST_H_ + +#include + +unsigned int find_closest(int x, const int *a, unsigned int as); +unsigned int find_closest_descending(int x, const int *a, unsigned int as); + +#endif /* _LINUX_FIND_CLOSEST_H_ */ diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index 825487fb66fa..478d4821f2d1 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h @@ -3,66 +3,7 @@ #define _LINUX_HELPER_MACROS_H_ #include - -/** - * find_closest - locate the closest element in a sorted array - * @x: The reference value. - * @a: The array in which to look for the closest element. Must be sorted - * in ascending order. - * @as: Size of 'a'. - * - * Returns the index of the element closest to 'x'. - * Note: If using an array of negative numbers (or mixed positive numbers), - * then be sure that 'x' is of a signed-type to get good results. - */ -#define find_closest(x, a, as) \ -({ \ - typeof(as) __fc_i, __fc_as = (as) - 1; \ - long __fc_mid_x, __fc_x = (x); \ - long __fc_left, __fc_right; \ - typeof(*a) const *__fc_a = (a); \ - for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ - __fc_mid_x = (__fc_a[__fc_i] + __fc_a[__fc_i + 1]) / 2; \ - if (__fc_x <= __fc_mid_x) { \ - __fc_left = __fc_x - __fc_a[__fc_i]; \ - __fc_right = __fc_a[__fc_i + 1] - __fc_x; \ - if (__fc_right < __fc_left) \ - __fc_i++; \ - break; \ - } \ - } \ - (__fc_i); \ -}) - -/** - * find_closest_descending - locate the closest element in a sorted array - * @x: The reference value. - * @a: The array in which to look for the closest element. Must be sorted - * in descending order. - * @as: Size of 'a'. - * - * Similar to find_closest() but 'a' is expected to be sorted in descending - * order. The iteration is done in reverse order, so that the comparison - * of '__fc_right' & '__fc_left' also works for unsigned numbers. - */ -#define find_closest_descending(x, a, as) \ -({ \ - typeof(as) __fc_i, __fc_as = (as) - 1; \ - long __fc_mid_x, __fc_x = (x); \ - long __fc_left, __fc_right; \ - typeof(*a) const *__fc_a = (a); \ - for (__fc_i = __fc_as; __fc_i >= 1; __fc_i--) { \ - __fc_mid_x = (__fc_a[__fc_i] + __fc_a[__fc_i - 1]) / 2; \ - if (__fc_x <= __fc_mid_x) { \ - __fc_left = __fc_x - __fc_a[__fc_i]; \ - __fc_right = __fc_a[__fc_i - 1] - __fc_x; \ - if (__fc_right < __fc_left) \ - __fc_i--; \ - break; \ - } \ - } \ - (__fc_i); \ -}) +#include /** * is_insidevar - check if the @ptr points inside the @var memory range. diff --git a/lib/Makefile b/lib/Makefile index f1c6e9d76a7c..e8e738c9ced8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -35,7 +35,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ is_single_threaded.o plist.o decompress.o kobject_uevent.o \ earlycpio.o seq_buf.o siphash.o dec_and_lock.o \ nmi_backtrace.o win_minmax.o memcat_p.o \ - buildid.o objpool.o iomem_copy.o + buildid.o objpool.o iomem_copy.o find_closest.o lib-$(CONFIG_UNION_FIND) += union_find.o lib-$(CONFIG_PRINTK) += dump_stack.o diff --git a/lib/find_closest.c b/lib/find_closest.c new file mode 100644 index 000000000000..d481625cae9d --- /dev/null +++ b/lib/find_closest.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Find closest element functions + * + * Based on previous util_macros.h implementation + */ + +#include +#include + +/** + * find_closest - locate the closest element in a sorted array + * @x: The reference value. + * @a: The array in which to look for the closest element. Must be sorted + * in ascending order. + * @as: Size of 'a'. + * + * Returns the index of the element closest to 'x'. + */ +unsigned int find_closest(int x, const int *a, unsigned int as) +{ + unsigned int array_size = as - 1; + int mid_x, left, right; + unsigned int i; + + for (i = 0; i < array_size; i++) { + mid_x = (a[i] + a[i + 1]) / 2; + if (x <= mid_x) { + left = x - a[i]; + right = a[i + 1] - x; + if (right < left) + i++; + break; + } + } + + return i; +} +EXPORT_SYMBOL_GPL(find_closest); + +/** + * find_closest_descending - locate the closest element in a sorted array + * @x: The reference value. + * @a: The array in which to look for the closest element. Must be sorted + * in descending order. + * @as: Size of 'a'. + * + * Similar to find_closest() but 'a' is expected to be sorted in descending + * order. The iteration is done in reverse order, so that the comparison + * of 'right' & 'left' also works for unsigned numbers. + */ +unsigned int find_closest_descending(int x, const int *a, unsigned int as) +{ + unsigned int array_size = as - 1; + int mid_x, left, right; + unsigned int i; + + for (i = array_size; i >= 1; i--) { + mid_x = (a[i] + a[i - 1]) / 2; + if (x <= mid_x) { + left = x - a[i]; + right = a[i - 1] - x; + if (right < left) + i--; + break; + } + } + + return i; +} +EXPORT_SYMBOL_GPL(find_closest_descending);