Skip to content

Commit

Permalink
drm/nouveau/gpio: enable interrupts on cards with 32 gpio lines
Browse files Browse the repository at this point in the history
The code attempts to enable them, but hits an undefined behaviour by
shifting by the entire register's width:

    int lines = 32;
    u32 mask = (1 << lines) - 1;    // 00000000 on x86
    u32 mask = (1 << lines) - 1;    // ffffffff on arm (32)
    u32 mask = (1 << lines) - 1;    // 00000000 on arm64
    u32 mask = (1ULL << lines) - 1; // ffffffff everywhere

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Adam Borowski authored and Ben Skeggs committed Apr 6, 2017
1 parent b2c4ef7 commit 99a97a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static int
nvkm_gpio_fini(struct nvkm_subdev *subdev, bool suspend)
{
struct nvkm_gpio *gpio = nvkm_gpio(subdev);
u32 mask = (1 << gpio->func->lines) - 1;
u32 mask = (1ULL << gpio->func->lines) - 1;

gpio->func->intr_mask(gpio, NVKM_GPIO_TOGGLED, mask, 0);
gpio->func->intr_stat(gpio, &mask, &mask);
Expand Down

0 comments on commit 99a97a8

Please sign in to comment.