[PATCH v1 1/6] sdio: Add syntactic sugar to store a pointer in sdio_driver_id

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Apr 21 23:52:11 PDT 2026


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.

-- 
With Best Regards,
Andy Shevchenko





More information about the Linux-mediatek mailing list