]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
pinctrl: intel: Constify intel_get_community() returned object
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 29 Aug 2024 13:59:19 +0000 (16:59 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 30 Aug 2024 18:44:38 +0000 (21:44 +0300)
There is nothing prevents us from constifying intel_get_community()
returned object. Do it to make code more robust.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/pinctrl/intel/pinctrl-baytrail.c
drivers/pinctrl/intel/pinctrl-intel.c
drivers/pinctrl/intel/pinctrl-intel.h
drivers/pinctrl/intel/pinctrl-lynxpoint.c

index 4e87f5b875c0e8f7089b9411c9b1610eaa2a8b9a..d39e666a62dfe1fb493a9da5f2a2912899ea2ca2 100644 (file)
@@ -560,9 +560,10 @@ static DEFINE_RAW_SPINLOCK(byt_lock);
 static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset,
                                  int reg)
 {
-       struct intel_community *comm = intel_get_community(vg, offset);
+       const struct intel_community *comm;
        u32 reg_offset;
 
+       comm = intel_get_community(vg, offset);
        if (!comm)
                return NULL;
 
index 46530ee6e92df2545b3ebfca7ffa450706b74140..e8dbaf3964dc49f808393a5a6ac4b25bff32e46b 100644 (file)
@@ -114,9 +114,9 @@ struct intel_community_context {
 #define pin_to_padno(c, p)     ((p) - (c)->pin_base)
 #define padgroup_offset(g, p)  ((p) - (g)->base)
 
-struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
+const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
 {
-       struct intel_community *community;
+       const struct intel_community *community;
        int i;
 
        for (i = 0; i < pctrl->ncommunities; i++) {
@@ -236,7 +236,7 @@ enum {
 
 static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
 {
-       struct intel_community *community;
+       const struct intel_community *community;
        const struct intel_padgroup *padgrp;
        unsigned int offset, gpp_offset;
        u32 value;
@@ -1368,7 +1368,7 @@ static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
        int ret, i;
 
        for (i = 0; i < pctrl->ncommunities; i++) {
-               struct intel_community *community = &pctrl->communities[i];
+               const struct intel_community *community = &pctrl->communities[i];
 
                ret = intel_gpio_add_community_ranges(pctrl, community);
                if (ret) {
index 6981e2fab93f34998b737ac39446c4eed5646923..c7b025ea989a05a854e4fe138bb4cca3982c567b 100644 (file)
@@ -264,7 +264,7 @@ int intel_pinctrl_probe_by_uid(struct platform_device *pdev);
 
 extern const struct dev_pm_ops intel_pinctrl_pm_ops;
 
-struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
+const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
 
 int intel_get_groups_count(struct pinctrl_dev *pctldev);
 const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);
index 1fb0bba8b386b9114f240e2767f13888f24821ae..bcce97f3b8975e639c7ecbd239b3b568fc0d57f4 100644 (file)
@@ -211,7 +211,7 @@ static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
                                 int reg)
 {
        struct intel_pinctrl *lg = gpiochip_get_data(chip);
-       struct intel_community *comm;
+       const struct intel_community *comm;
        int reg_offset;
 
        comm = intel_get_community(lg, offset);