From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 D3DDF27FD44 for ; Thu, 27 Nov 2025 13:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764250947; cv=none; b=Fc15EugsOK8qKNZkyyegG4tDb43F9N2M2oRBQK3X1m9PMkSBDaFRyIThdFX3Wty0R56T5f+2FjGBIncyK8tWBnQij9gmnrglCTIbtS7GuBRsTdNL5mhV7etMlb5nUXRjaMFbZdaNMavdrtediEmYDwP3Ik7CbLK5xku5zVrTALQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764250947; c=relaxed/simple; bh=R9dPhLuK1onF4dCRQ+094LsOQKh+XIVI8g0bRwXb+hs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jh6Vt6FMjndACsYa3clPUnmCtnIhQFqLGF0hI1sNHrkE2o2KTyGrAK7fuHbp5A+dmohKSDmS2xWR1BEnSev48zfFDMmmNCdTdvEWY1rzZJbFWZNjfg4uG5WL3b+2TiBSHqmKnGFAnzP3qjTNPWP+VwE9NJz2mLJMTDe3zsE2MLM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jKuBGtkR; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=L8Lzhi99; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jKuBGtkR"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="L8Lzhi99" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5ARCpZMv2856158 for ; Thu, 27 Nov 2025 13:42:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wBsuMWDT50l9fpxTrmFtEsFBa7H7uACR9TerGQtNXCQ=; b=jKuBGtkRFNXB9Vh3 IgbIPQeLt2MLSBpkL6pic/TCbbH9zFzEIW/CfmymcIexW+z2KgsdrkeTwzl02Gqa zgqyFtB0stqKwfqUxCrFt8wZmEOl1Q46CZTohkKPcb8flGkBWcLSf+OlDK2szexy 2MxybXvTqBD3I+WsZIL3qaZNECG1o3Z4vXbWUw/lfYQy45ir5oauixNq+MOQcz6A L3IN397gjgycaoVQRckfO1Ry2tQJMn93W3z+HezEEeMREsCjZb9TFjqeuYmT5IOj 0g00n4m6Rz9X2L/BnH532gGQ/43Ie4w5ZW5POrMzicRxSk1l4CvXVWfdARMlYnZ4 dS9x0A== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ap4vhb22g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 27 Nov 2025 13:42:24 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8a1c15daa69so202811785a.1 for ; Thu, 27 Nov 2025 05:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764250944; x=1764855744; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=wBsuMWDT50l9fpxTrmFtEsFBa7H7uACR9TerGQtNXCQ=; b=L8Lzhi99oM23CHdGLucAy1vQpVZ8v71UbGxe4X0zfAMu/2Sg+o4vTXg6S8kHoq58hT 8/mOVyJA4jKaFi3uaB1zwU3wlb8LzjziDYkoKM1veoqzR0uSVGSP7It8CS94cmNa/m06 I9wyVRXTJNZopk+7zXbAzCLR1z2PdNwE7J9NfFlCBfN86E42Jon7V9yGx3bAicZGwytM Y1XeXvuD87aoL+LW8fGgNlQiEWEwEK7kN/Z/UdbCbIlMj8S2IO0EIvSCP7gcW2rK/AAy 3WEskeoBHjRuY6zHz+xMdXkq1AjbYw2rCEy59o22K1etCsE2tH9wQccaWdMk+Ob4Q4X0 Fj1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764250944; x=1764855744; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from: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; bh=wBsuMWDT50l9fpxTrmFtEsFBa7H7uACR9TerGQtNXCQ=; b=bhtTSYa2ohKr6/NB71jKg1E4C5uOPYGAkr9SYtRjVgXVJXJBThMUSLy1qN5/dSWvM5 5DfQ/iMkxp1PU1HBDgUWve1eJec3c5b85D46kjZe/GOTfsz8tAse13lGGFBCWT9PKFSJ TnDE9oG7YmuzV6BxGKKuQbKNQdDYcqnN6d4cLoirxq84AzvN7oKu5OhctSbNzg4UjvMr +Re4X3CfZywm5+4l+N6j04epBqIarfP+35bqR2Tj461itjZSogD6xDlg9qG5EKdwoeSR Pmsdq58Fo5GUjQKnthpo9RIDi9ps1Viwi1lCWCrXiIFEqoaTZl3WBzo9U9LItYzQhN0V 9wkw== X-Forwarded-Encrypted: i=1; AJvYcCWTyNdv2Q9priAbkyE4iNuZirrOR+sdpv568BRnv3I7IOvOS1RRikigcnUWbFif4wfS63iUhRsHdl7kpH4=@vger.kernel.org X-Gm-Message-State: AOJu0YyPIbWwzXporZjRkCWAFFdLPcvkzFqsAnZpML7SMfJ7fGfUmkKO tpV6r07IT3VZv3teDrHSn9fz8DireqVdcQQgEmOxn4oy2WM2NBC1ZDNIYACd0whAfCPT11yOj/X 4dEyVbuYXBdLmEceAdtTFFzaudhvEfMR/QX35aXyxwilQ+Y8U9rzKFVKfLyy/3NxqhAw= X-Gm-Gg: ASbGnctKmfY+d5HInzQiPdRfxR0YeHdYNaGDPuDyKz1Hf24D0F9L7hIWtaopXVZvXQe oxPLhmLsFiPj2AGZTqAJ9DujD4wG4GRzMTjGhpLEq3xMej2wKFNUI696FvyefCelInS3iMyT0sC uu4MMW8YcIdJMm2PhVzkwJ6djDD3FSD+oXr6RHhukuEJWDqSfxVg0BjSjGZ33u6PJYyu1zX02Mu bSBRrHoi8M9vrv91H9p1UVm1YjhLyml98XKsWfAVQe2UT6RbFRrvtQMwxIpx7mJoYelpgtrXjFk KbpdkH7yep6vvSyganuqzDdjjV9o4AbfUZM5HQ+p7vHhK8mISlG14fuCQMZZ05KO+YfEDwJNKab mtlOp7Ebxan6My47KKKU8VYyiDF5QPjJk0+2zaQ== X-Received: by 2002:a05:620a:44c5:b0:8b2:dabe:de38 with SMTP id af79cd13be357-8b4ebdae979mr1429401685a.43.1764250944190; Thu, 27 Nov 2025 05:42:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNvzt/PrOfhGZ8fmsoq/xodudy4WzNIdA5X/QjQaFX8lD5yGjc3Qp54CgRzqeLcTbs7sQX8A== X-Received: by 2002:a05:620a:44c5:b0:8b2:dabe:de38 with SMTP id af79cd13be357-8b4ebdae979mr1429398285a.43.1764250943695; Thu, 27 Nov 2025 05:42:23 -0800 (PST) Received: from [192.168.1.29] ([178.197.219.123]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1caae37esm3639930f8f.40.2025.11.27.05.42.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Nov 2025 05:42:23 -0800 (PST) Message-ID: Date: Thu, 27 Nov 2025 14:42:21 +0100 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 3/3] i2c: rcar: Fix Wvoid-pointer-to-enum-cast warning To: Geert Uytterhoeven Cc: Andi Shyti , Ray Jui , Scott Branden , Broadcom internal kernel review list , Wolfram Sang , Geert Uytterhoeven , Magnus Damm , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, llvm@lists.linux.dev References: <20251126182257.157439-4-krzysztof.kozlowski@oss.qualcomm.com> <20251126182257.157439-6-krzysztof.kozlowski@oss.qualcomm.com> <0e90817e-1c05-4fa3-a6fd-8e755608a2c9@oss.qualcomm.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzysztof.kozlowski@oss.qualcomm.com; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hV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3lFgg+c+rdZUHjsa247r+7fvm2zGG1/u+33lBJgnAIH 5lSCjhP4VXiGq5ngCxGRuBq+0jNCKyAOC/vq2cS/dgdXwmf2aL8G7QVREX7mSl0x+CjWyrpF c1D/9NV/zIWBG1NR1fFb+oeOVhRGubYfiS62htUQjGLK7qbTmrd715kH9Noww1U5HH7WQzeP t/SvC0RhQXNjXKBB+lwwM+XulFigmMF1KybRm7MNoLBrGDa3yGpAkHMkJ7NM4iSMdSxYAr60 RtThnhKc2kLIzd8GqyBh0nGPIL+1ZVMBDXw1Eu0/Du0rWt1zAKXQYVAfBLCTmkOnPU0fjR7q VT41xdJ6KqQMNGQeV+0o9X91X6VBeK6Na3zt5y4eWkve65DRlk1aoeBmhAteioLZlXkqu0pZ v+PKIVf+zFKuh0At/TN/618e/QVlZPbMeNSp3S3ieMP9Q6y4gw5CfgiDRJ2K9g99m6Rvlx1q wom6QbU06ltbvJE2K9oKd9nPp1NrBfBdEhX8oOwdCLJXEq83vdtOEqE42RxfYta4P3by0BHp cwzYbmi/Et7T2+47PN9NZAOyb771QoVr8A== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTI3MDEwMSBTYWx0ZWRfX0H9RdlRUYbl1 JHJiWvxETFwWHg0r5dEw5X2on01znVyw6ZN5M+VJ+XC/22gi0HnHoJw6AkQfMUlL28AhelTBgSO PmJ+tuYxHVuRqbVEqtaBT31GzWgJMGhVbJwJmh9OVqDYjjb0qvzLUOO/TIhN6XHdbyLCPR+/KtU 7gZ9I8Gld4dY3Y5dT7IF6wBLfzdN8qr/jBIQdnR34XvUuyEdVBq3ekSWxq202LhXBAvwJUMNsve luTYgsTt9QrIjbCmBANn2w1vsEJcdAGEip4WLRvfd2iIK20HROwg7iwwAygcbaKexhrkCITKmTh bP9eQXPYqI+Jwp1fV4l8IQkfn7zRxSTg29Y+3NukQWPFdtXmWzNZFP/e6nA1oUmB2w/65mHmawL 4KPvxTVjnmrrOzKCZqzln1RBaFFviQ== X-Proofpoint-ORIG-GUID: LMR3NOKMYYjEFngcoHeyF-ak2Lqqcnvt X-Proofpoint-GUID: LMR3NOKMYYjEFngcoHeyF-ak2Lqqcnvt X-Authority-Analysis: v=2.4 cv=Lt6fC3dc c=1 sm=1 tr=0 ts=69285540 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=Iax6wTeSMpqzYiZSKl48GQ==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=pGLkceISAAAA:8 a=-5l79d-VV7xRAF-9bO4A:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-25_02,2025-11-27_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511270101 On 27/11/2025 13:52, Geert Uytterhoeven wrote: > Hi Krzysztof, > > On Thu, 27 Nov 2025 at 12:48, Krzysztof Kozlowski > wrote: >> On 27/11/2025 12:42, Krzysztof Kozlowski wrote: >>>>> --- a/drivers/i2c/busses/i2c-rcar.c >>>>> +++ b/drivers/i2c/busses/i2c-rcar.c >>>>> @@ -1141,7 +1141,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) >>>>> if (IS_ERR(priv->io)) >>>>> return PTR_ERR(priv->io); >>>>> >>>>> - priv->devtype = (enum rcar_i2c_type)of_device_get_match_data(dev); >>>>> + priv->devtype = (kernel_ulong_t)of_device_get_match_data(dev); >>>> >>>> Any specific reason you picked "kernel_ulong_t" instead of "unsigned long"? >>>> The former seems to be the least common option. >>> >>> As I wrote in the first patch, because to my knowledge it is the > > I don't see that written in the first patch; it has the same patch description > as the other patches in the series (mutatis mutandis)? https://lore.kernel.org/all/20251126182257.157439-4-krzysztof.kozlowski@oss.qualcomm.com/ I meant that brief statement in the patch changelog. > >>> preferred form for holding driver data which are in general pointers. We >>> do not store pointers as unsigned long. It is also already used for the >>> driver data types - see include/linux/mod_devicetable.h. >> >> ... and in case it is still not obvious: I do not cast here to final >> type, because that cast is the reason for the warning. >> >> I cast to an intermediary type to help compiler suppressing the warning > > I know... > >> - to integer representing the pointer. Unsigned long is not representing >> pointers in the kernel. Integer type representing the pointer is > > "unsigned long" indeed does not represent a pointer, but in the Linux > kernel, it is guaranteed to be the same size as a pointer. > > '"unsigned long" is superior' > https://lore.kernel.org/CAHk-=wj2OHy-5e+srG1fy+ZU00TmZ1NFp6kFLbVLMXHe7A1d-g@mail.gmail.com > (he doesn't seem to have said anything about kernel_ulong_t) Yes, that was again comparing to uintptr_t, so we both agree. > >> kernel_ulong_t, I think. > > include/linux/mod_devicetable.h:typedef unsigned long kernel_ulong_t; > > IIRC, it was introduced originally because "unsigned long" might have > a different size in userspace. Nowadays (for x32), uapi uses > __kernel_ulong_t, though. Maybe, but if you look at the data structures all have kernel_ulong_t, so this fits the logic I was following here - I cast to the type which is both representing pointer and is already used for driver data, because this match data serves similar purpose as mentioned driver data. I don't mind casting via unsigned long, but: 1. these are old and trivial issues, 2. they are quite annoying when people want to compile test with W=1, 3. I was trying to fix them (although not sure if for I2C) already, 4. and some others probably as well were trying to fix them, so how many people need to send them and debate before we fix them finally? unsigned long vs kernel_ulong_t is a nit-style discussion IMO, unless we have here more concrete arguments, e.g. statement from Linus that kernel_ulong_t is wrong. If maintainers of this code want unsigned long, please apply the patch and fix directly, but for the sake, let's get it merged... Best regards, Krzysztof