OSDN Git Service

staging: mt7621-gpio: fix masks for gpio pin
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Fri, 25 May 2018 16:54:49 +0000 (18:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Jun 2018 09:17:05 +0000 (11:17 +0200)
commite119216dea2dd7c78e231c06b9822072bb4a553e
tree2f1fcfb03e4a0a3004d7f31c95cf5d6633d36aca
parentba64745694e20b4aa6738f17c1583c7f4832daf5
staging: mt7621-gpio: fix masks for gpio pin

BIT macro is being used to get mask for gpio's pin
which is retrieved using 'hwirq' from struct irq_data.
The problem here is that 'hwirq' can be as large as 95,
and 1UL << 95 is unlikely to work well. Instead of using
BIT macro use a new PIN_MASK macro which takes into account
pin and WIDTH of the bank in order to make a proper mask for
the gpio pin. Also 'd->hwirq' has been replaced by 'pin' in
some places because there was a 'pin' variable in changed
functions with the proper value. This improves readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-gpio/gpio-mt7621.c