From: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Max Staudt <max@enpas.org>, Andi Shyti <andi.shyti@kernel.org>,
Helge Deller <deller@gmx.de>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
"Christian A. Ehrhardt" <christian.ehrhardt@codasip.com>,
"Christian A. Ehrhardt" <lk@c--e.de>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
netdev@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v1 6/8] zorro: Simplify storing pointers in device id struct
Date: Tue, 26 May 2026 16:17:32 +0200 [thread overview]
Message-ID: <49576a7501128c93ef318566ed7faefce163f1fd.1779803053.git.u.kleine-koenig@baylibre.com> (raw)
In-Reply-To: <cover.1779803053.git.u.kleine-koenig@baylibre.com>
Technically it is fine (on all current Linux architectures) to store a
pointer in an unsigned long variable. However this needs explicit
casting which is an easy source for type mismatches.
By replacing the plain unsigned long .driver_data in struct
zorro_device_id by an anonymous union, most of the casting can be
dropped. There is still some implicit casting involved (between a void *
and a driver specific pointer type), but that's better than the approach
to store a pointer in an unsigned long variable as this doesn't lose the
information that the data being pointed to is const.
All users of struct zorro_device_id are initialized in a way that is
compatible with the new definition, so no adaptions are needed there.
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
include/linux/mod_devicetable.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 3b0c9a251a2e..2673a1bd82c4 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -640,7 +640,11 @@ struct mdio_device_id {
struct zorro_device_id {
__u32 id; /* Device ID or ZORRO_WILDCARD */
- kernel_ulong_t driver_data; /* Data private to the driver */
+ union {
+ /* Data private to the driver */
+ kernel_ulong_t driver_data;
+ const void *driver_data_ptr;
+ };
};
#define ZORRO_WILDCARD (0xffffffff) /* not official */
--
2.47.3
next prev parent reply other threads:[~2026-05-26 14:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 14:17 [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data Uwe Kleine-König (The Capable Hub)
2026-05-26 14:17 ` [PATCH v1 5/8] video: fm2fb: Use named initializer for zorro_device_id array Uwe Kleine-König (The Capable Hub)
2026-05-27 4:47 ` Claude review: " Claude Code Review Bot
2026-05-26 14:17 ` Uwe Kleine-König (The Capable Hub) [this message]
2026-05-27 4:47 ` Claude review: zorro: Simplify storing pointers in device id struct Claude Code Review Bot
2026-05-26 14:17 ` [PATCH v1 8/8] video: cirrusfb: Make use of struct zorro_device_id::driver_data_ptr Uwe Kleine-König (The Capable Hub)
2026-05-27 4:47 ` Claude review: " Claude Code Review Bot
2026-05-26 15:01 ` [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data Geert Uytterhoeven
2026-05-26 16:38 ` Uwe Kleine-König (The Capable Hub)
2026-05-27 4:47 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49576a7501128c93ef318566ed7faefce163f1fd.1779803053.git.u.kleine-koenig@baylibre.com \
--to=u.kleine-koenig@baylibre.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=andi.shyti@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=cassel@kernel.org \
--cc=christian.ehrhardt@codasip.com \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=dlemoal@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=kuba@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lk@c--e.de \
--cc=martin.petersen@oracle.com \
--cc=max@enpas.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox