pwm: Allow 32-bit tasks to use the character device

pwm_cdev_fileops has no .compat_ioctl, so every ioctl on /dev/pwmchipN
fails with -ENOTTY for 32-bit tasks on a 64-bit kernel, e.g. armhf
userspace on arm64.

struct pwmchip_waveform has the same layout for 32-bit and 64-bit tasks,
so compat_ptr_ioctl() is enough. PWM_IOCTL_REQUEST and PWM_IOCTL_FREE
take an integer rather than a pointer, which is fine too: compat_ptr()
only changed the value on s390, which dropped compat support in v6.19.

Fixes: 9c06f26ba5 ("pwm: Add support for pwmchip devices for faster and easier userspace access")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Link: https://patch.msgid.link/20260928184422.380520-1-danishkhateeb03@gmail.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
Danish Khateeb 2026-09-28 13:44:22 -05:00 committed by Uwe Kleine-König
parent 17dbb6938d
commit 45c3d07e3f

View File

@ -2389,6 +2389,7 @@ static const struct file_operations pwm_cdev_fileops = {
.release = pwm_cdev_release,
.owner = THIS_MODULE,
.unlocked_ioctl = pwm_cdev_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
static dev_t pwm_devt;