From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: Ulf Hansson <ulfh@kernel.org>,
"Christian A. Ehrhardt" <christian.ehrhardt@codasip.com>,
linux-mmc@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-kernel@vger.kernel.org,
Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-bluetooth@vger.kernel.org,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-mediatek@lists.infradead.org,
Ping-Ke Shih <pkshih@realtek.com>,
linux-wireless@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v1 1/6] sdio: Add syntactic sugar to store a pointer in sdio_driver_id
Date: Mon, 11 May 2026 16:33:52 +0200 [thread overview]
Message-ID: <CAPDyKFo6nvBCnOHXUSvedaT3Rnob+oF=nZoRoic_EkgFBTxzwg@mail.gmail.com> (raw)
In-Reply-To: <c830049dcfcd99f005e2ff6742aace9341c61f13.1776429984.git.u.kleine-koenig@baylibre.com>
On Fri, 17 Apr 2026 at 15:11, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@baylibre.com> 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.
> Additionally with the CHERI architecture extension there are machines
> with sizeof(void *) > sizeof(long) for with the traditional approach of
> storing a pointer in .driver_data doesn't work.
>
> By replacing the plain unsigned long .driver_data by an anonymous union,
> most of the casting can be dropped and it yields a working solution for
> CHERI.
>
> All users of struct sdio_driver_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>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Feel free to take this via whatever tree makes best sense!
Kind regards
Uffe
> ---
> include/linux/mod_devicetable.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 5b1725fe9707..0eb5d196f5b5 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -414,7 +414,10 @@ struct sdio_device_id {
> __u8 class; /* Standard interface or SDIO_ANY_ID */
> __u16 vendor; /* Vendor or SDIO_ANY_ID */
> __u16 device; /* Device ID or SDIO_ANY_ID */
> - 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;
> + };
> };
>
> /* SSB core, see drivers/ssb/ */
> --
> 2.47.3
>
next prev parent reply other threads:[~2026-05-11 14:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 13:10 [PATCH v1 0/6] sdio: About pointers in sdio_device_id::driver_data Uwe Kleine-König (The Capable Hub)
2026-04-17 13:10 ` [PATCH v1 1/6] sdio: Add syntactic sugar to store a pointer in sdio_driver_id Uwe Kleine-König (The Capable Hub)
2026-04-20 20:31 ` Uwe Kleine-König (The Capable Hub)
2026-04-20 20:46 ` Luiz Augusto von Dentz
2026-04-21 8:12 ` Uwe Kleine-König (The Capable Hub)
2026-04-21 8:59 ` Johannes Berg
2026-04-21 14:28 ` Uwe Kleine-König (The Capable Hub)
2026-04-21 15:54 ` Johannes Berg
2026-04-22 6:52 ` Andy Shevchenko
2026-04-22 8:39 ` Uwe Kleine-König (The Capable Hub)
2026-04-22 10:56 ` Christian A. Ehrhardt
2026-04-22 12:44 ` Andy Shevchenko
2026-05-26 9:38 ` Uwe Kleine-König (The Capable Hub)
2026-05-11 14:33 ` Ulf Hansson [this message]
2026-04-17 13:10 ` [PATCH v1 3/6] Bluetooth: btmtksdio: Make use of driver data pointer in sdio_device_id Uwe Kleine-König (The Capable Hub)
2026-04-17 13:10 ` [PATCH v1 5/6] wifi: mt76: mt7921-sdio: " Uwe Kleine-König (The Capable Hub)
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='CAPDyKFo6nvBCnOHXUSvedaT3Rnob+oF=nZoRoic_EkgFBTxzwg@mail.gmail.com' \
--to=ulf.hansson@linaro.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=briannorris@chromium.org \
--cc=christian.ehrhardt@codasip.com \
--cc=francesco@dolcini.it \
--cc=gregkh@linuxfoundation.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=pkshih@realtek.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=ulfh@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).