[PATCH v1 1/6] sdio: Add syntactic sugar to store a pointer in sdio_driver_id
Uwe Kleine-König (The Capable Hub)
u.kleine-koenig at baylibre.com
Wed Apr 22 01:39:09 PDT 2026
On Wed, Apr 22, 2026 at 09:52:11AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 21, 2026 at 10:12:41AM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > On Mon, Apr 20, 2026 at 04:46:56PM -0400, Luiz Augusto von Dentz wrote:
> > > On Mon, Apr 20, 2026 at 4:31 PM Uwe Kleine-König (The Capable Hub)
> > > <u.kleine-koenig at baylibre.com> wrote:
> > > > On Fri, Apr 17, 2026 at 03:10:47PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > > > > On all current Linux architectures sizeof(long) == sizeof(void *) and
> > > > > this is used a lot through the kernel. For example it enables the usual
> > > > > practice to store pointers in sdio_driver_id's .driver_data member.
> > > > >
> > > > > This works fine, but involves casting and thus isn't type-safe.
> >
> > To be honest, with the involved void* this isn't really type-safe
> > either, but at least the data keeps being a pointer which is really
> > helpful on CHERI. FTR: The alternative would be to use uintptr_t instead
> > of unsigned long, which also has proponents in the CHERI community and
> > which is used in the current vendor patch stack.
>
> FWIW, Linus categorically told that it has to be no uintptr_t in the Linux kernel.
Then I'm lucky that this patch set doesn't introduce uintptr_t and so we
can delay the discussion with Linus about that. (And we will have to
hold that discussion at some point, because on CHERI we have
sizeof(unsigned long) = 8 < sizeof(void *) = 16. I didn't check, but I
think also unsigned long long cannot hold a void*.
Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20260422/212d2776/attachment-0001.sig>
More information about the Linux-mediatek
mailing list