From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 228B83783CC for ; Wed, 27 May 2026 15:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779894972; cv=none; b=szkW4SrlnNz+zLzs02L3kAbWNc91Fv8vjGZpLDamweKV/bs++hw5hNaV0S/wguBjBoynMcfHRTaiPPYoAVXZczZpNHfonbKpkvQyeNFXH+8boakamdCX1UFHb2/inOCdjQZlZrJjq0IvJrMBlCpiyWCzbFi3XK8r53P7+GItCd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779894972; c=relaxed/simple; bh=SGG782v8heskkgCeEQh5ro9Lc0JQOnQsegfm05Pe5/w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JJrdaD6XtJizoFLD+Wu1JwTkzWK3ShF2V43dfS4j+djGt8jdj9zC86nlAzezmraC700RtR9y/6PoG2wOFBqnCUFskPVZ36ai0pwHe8Bxbhi5mXnMMMPQ+cy+zerdk0WfpT16yLJ9f6Go7MaaHBu5O0oV9xIY80u2enKQPR3TYz8= 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=WujUy/GM; arc=none smtp.client-ip=209.85.128.46 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="WujUy/GM" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4905e190c71so41376125e9.3 for ; Wed, 27 May 2026 08:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1779894965; x=1780499765; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZBKA0gQ+xW1wOyleBB29AXk8NtnAnaeMeyXMssYDYpc=; b=WujUy/GM7ABdSvg2XdehdtkJbJoCfHERRQA812ySXG/744XAtOzfSFF3PS4YumX1l1 yeBzIhsQC3Zf9EfGa2SVGu0B51SsjNBMZ6y1OmZp6MqNOMPD7BT8h/OQsPSvAqJJ5Bxy RikxKX0ktBXZUTRkq6Z77KslVW/GjAIF5Tavdo4yQO3PYkttkITjQCeE1rkJ89zuvN9O X0xkIS/DhkPOc6VJVXqtC1hWwPr053+srw72zW0MBCsOQFO0DVKgcwvrf9ZdOoKRIF6o 4sfHpFMp2e0VjG6STW61MwwikH31XYLfw+GvUeM5t1jmA2a95lUbBcA7T7Gc+EqHlHpQ rVrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779894965; x=1780499765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZBKA0gQ+xW1wOyleBB29AXk8NtnAnaeMeyXMssYDYpc=; b=gmqlk/XLGQT7W52NICUvOdzKuEhEsK/HbODqboT3H42c2cc0wVBFW8Q6d/B0170YSO YLhsM3XcUVVhRSd7AYbI8Ag73MyeD6Af22aQTwUbSYnxIs3m8YPC4kgH7VZWMj0goCP2 85qdhJImjzobQhGIFnY7wy8Vh49N3ozkeKT32YnLKPKUqvCVJxoDuK+vRVVx2Cotw71k c5SXR8neX182A9MaTsyQksGwqOppPVu8mnoPY/AIUa3UZyVayf2O1itx0DPebpqKkqm8 OnZAWv+y1P9dYR93rLY2K5pNwamoElig4vgGF4bRQWm2cltEQQwpKib3cjcwqC7PV526 jqIA== X-Forwarded-Encrypted: i=1; AFNElJ/iXqely+bV5mc+bFUCrTTbr1SEXHa4Yk+qeYj2sUicD/W3HdfdnpUEWfhIIqiZTjIQEyEJCtT7iRBXqNw=@vger.kernel.org X-Gm-Message-State: AOJu0YxjOhNqsB8CvaGAIxTAIQCuCCZ4GlgfrVr+xyEQzbN0No6XyeRn CECgWdi+4O8MyIkZiDbYQUG4D2NM7OjTBELz8UU1nnaeJ+JDRF4nydfTOKtLbDC9rNA= X-Gm-Gg: Acq92OFs6RF3ApYrIM130ydb+YPlLwOLH7JM0rOMSvKNUMiSNIJw+sbeCBahcsHvIit K/hNPzT/7TgCtO+ufm0Hdd9Rg8ktVwpemL7VUQlTi861TUb1c3ZscvH7PyQYNlGHh5hz9DDG8vk PU7mSxwC/1MKYvhdnuM5i1GBmhfIdg9j+QYdnk8BRFidPQPtqKvaVEyXndoR6J2jFcfyWUkHGIE CFOlAA0Jjr2eGltS3PV7DlGVP9c81NOQ2JZAZArBJt8zkG8zFBvFHVoDzngvKMmMCqa99Y9xugV katHzpNiSBTJdolgOjTzwGZJl5dOnl+YlmFzByhlNcvjC2xo2AIA82Dy1bOtjj6UEAIV7IroZW8 t9W0RYUDXMD4LZjmAVOg1jTiJhNS3mjPoaWulfKf+0xi0UZSWZnowmExlMeIq+P7fDCRI5Ljn+q Lh1CbATesr38a4nvlLaiazCIKsjMAm8+HnBqFX8efSPSl5gfgECNfMb3CQsutRraIhrsLT+OjU1 MJwzX/7ytOKq2140YUoqb2utQ== X-Received: by 2002:a05:600c:c4a3:b0:488:ac01:72b6 with SMTP id 5b1f17b1804b1-490426ceed2mr397237005e9.21.1779894964634; Wed, 27 May 2026 08:16:04 -0700 (PDT) Received: from localhost (p200300f65f47db042b54ed4dbf2ca0b5.dip0.t-ipconnect.de. [2003:f6:5f47:db04:2b54:ed4d:bf2c:a0b5]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-490452765f5sm419367545e9.5.2026.05.27.08.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 08:16:04 -0700 (PDT) From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= To: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Guenter Roeck , Benson Leung Cc: chrome-platform@lists.linux.dev, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/2] hwmon: Date: Wed, 27 May 2026 17:15:51 +0200 Message-ID: X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=3738; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=SGG782v8heskkgCeEQh5ro9Lc0JQOnQsegfm05Pe5/w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBqFwqoXEPjhtu6utYDTpQtB8ZlzavCDK5CSA5zV XzX/FvzVcKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCahcKqAAKCRCPgPtYfRL+ Tl48B/0UFmLrw/2YNxpw6oKq52oQdjKz+1+P2QJgibL321MjIBqXyuFt66y9bIABp+GKKdf8H9E vYaEVbi/o6J9QPcv798Dn30ilhL7M293OSYBrRhNWBLnbl+1ap4XT7gX67+dePfdheFcoGkPu+g LubGGLhTemddTW2qQuzFtvKbjTxO/wtOjBfcgG8cpe5jFZZSO6LfVF3n5oodHhF6X3X2Qz7gy1d CyIvHdt4ld85LxOsU2jSUKV9G3P0Jaz5ij4ZoEc5TJ3DoSbkSiPnmQJhZRIyxebYxH2XhkMcjxW JPWlAjWHAjBxGvvk/Kfcwm4JCV6On8hEK8P33HzAilPBA6MM X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: 8bit Hello, this series targets to use named initializers for platform_device_id arrays. In general these are better readable for humans and more robust to changes in the respective struct definition. This robustness is needed as I want to do diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -610,4 +610,7 @@ struct dmi_system_id { struct platform_device_id { char name[PLATFORM_NAME_SIZE]; - kernel_ulong_t driver_data; + union { + kernel_ulong_t driver_data; + const void *driver_data_ptr; + }; }; which allows dropping several casts and eases porting CHERI to mainline linux. A possible follow-up change is the following example: diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 5d61053e0596..03bc8e859d73 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -534,7 +534,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { static int pxa_gpio_nums(struct platform_device *pdev) { const struct platform_device_id *id = platform_get_device_id(pdev); - struct pxa_gpio_id *pxa_id = (struct pxa_gpio_id *)id->driver_data; + struct pxa_gpio_id *pxa_id = id->driver_data_ptr; int count = 0; switch (pxa_id->type) { @@ -708,14 +708,14 @@ static int pxa_gpio_probe(struct platform_device *pdev) } static const struct platform_device_id gpio_id_table[] = { - { .name = "pxa25x-gpio", .driver_data = (unsigned long)&pxa25x_id }, - { .name = "pxa26x-gpio", .driver_data = (unsigned long)&pxa26x_id }, - { .name = "pxa27x-gpio", .driver_data = (unsigned long)&pxa27x_id }, - { .name = "pxa3xx-gpio", .driver_data = (unsigned long)&pxa3xx_id }, - { .name = "pxa93x-gpio", .driver_data = (unsigned long)&pxa93x_id }, - { .name = "mmp-gpio", .driver_data = (unsigned long)&mmp_id }, - { .name = "mmp2-gpio", .driver_data = (unsigned long)&mmp2_id }, - { .name = "pxa1928-gpio", .driver_data = (unsigned long)&pxa1928_id }, + { .name = "pxa25x-gpio", .driver_data_ptr = &pxa25x_id }, + { .name = "pxa26x-gpio", .driver_data_ptr = &pxa26x_id }, + { .name = "pxa27x-gpio", .driver_data_ptr = &pxa27x_id }, + { .name = "pxa3xx-gpio", .driver_data_ptr = &pxa3xx_id }, + { .name = "pxa93x-gpio", .driver_data_ptr = &pxa93x_id }, + { .name = "mmp-gpio", .driver_data_ptr = &mmp_id }, + { .name = "mmp2-gpio", .driver_data_ptr = &mmp2_id }, + { .name = "pxa1928-gpio", .driver_data_ptr = &pxa1928_id }, { } }; increasing readability due to less casting. Also this results in the compiler warning: drivers/gpio/gpio-pxa.c: In function ‘pxa_gpio_nums’: drivers/gpio/gpio-pxa.c:537:38: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 537 | struct pxa_gpio_id *pxa_id = id->driver_data_ptr; | ^~ which is a good thing as adding the needed const to fix this warning improves type safety. (There is no hwmon driver that benefits from this change, so a driver from a different subsystem was used to show the benefit.) Best regards Uwe Uwe Kleine-König (The Capable Hub) (2): hwmon: cros_ec: Drop unused assignment of platform_device_id driver data hwmon: Use named initializers for platform_device_id arrays drivers/hwmon/cros_ec_hwmon.c | 4 ++-- drivers/hwmon/max197.c | 4 ++-- drivers/hwmon/ntc_thermistor.c | 24 ++++++++++++------------ drivers/hwmon/sht15.c | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) base-commit: e7e28506af98ce4e1059e5ec59334b335c00a246 -- 2.47.3