aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorRaag Jadav2023-05-22 10:28:06 +0530
committerBartosz Golaszewski2023-05-23 10:22:25 +0200
commit3b8d8ccc39942cb4eced890c9776567b1e4117eb (patch)
tree19836aeb9b5c4af82ed22c245caa2248788b42ca /drivers/gpio
parentb41cabb7be3c8113af0357366bd5e41a34b05a50 (diff)
gpio: tangier: calculate number of ctx using temporary variable
Utilize a temporary variable to calculate number of ctx from ngpio inside ->probe() implementation. While at it, include math.h for using DIV_ROUND_UP(). Signed-off-by: Raag Jadav <raag.jadav@intel.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-tangier.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-tangier.c b/drivers/gpio/gpio-tangier.c
index e990781935ba..7ce3eddaed25 100644
--- a/drivers/gpio/gpio-tangier.c
+++ b/drivers/gpio/gpio-tangier.c
@@ -16,6 +16,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/spinlock.h>
@@ -428,10 +429,11 @@ static int tng_gpio_add_pin_ranges(struct gpio_chip *chip)
int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio)
{
const struct tng_gpio_info *info = &gpio->info;
+ size_t nctx = DIV_ROUND_UP(info->ngpio, 32);
struct gpio_irq_chip *girq;
int ret;
- gpio->ctx = devm_kcalloc(dev, DIV_ROUND_UP(info->ngpio, 32), sizeof(*gpio->ctx), GFP_KERNEL);
+ gpio->ctx = devm_kcalloc(dev, nctx, sizeof(*gpio->ctx), GFP_KERNEL);
if (!gpio->ctx)
return -ENOMEM;