Skip to content

Commit e075cbf

Browse files
committed
pinctrl: intel: Constify intel_get_community() returned object
There is nothing prevents us from constifying intel_get_community() returned object. Do it to make code more robust. Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 13791bb commit e075cbf

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

drivers/pinctrl/intel/pinctrl-baytrail.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,10 @@ static DEFINE_RAW_SPINLOCK(byt_lock);
560560
static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset,
561561
int reg)
562562
{
563-
struct intel_community *comm = intel_get_community(vg, offset);
563+
const struct intel_community *comm;
564564
u32 reg_offset;
565565

566+
comm = intel_get_community(vg, offset);
566567
if (!comm)
567568
return NULL;
568569

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ struct intel_community_context {
114114
#define pin_to_padno(c, p) ((p) - (c)->pin_base)
115115
#define padgroup_offset(g, p) ((p) - (g)->base)
116116

117-
struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
117+
const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
118118
{
119-
struct intel_community *community;
119+
const struct intel_community *community;
120120
int i;
121121

122122
for (i = 0; i < pctrl->ncommunities; i++) {
@@ -236,7 +236,7 @@ enum {
236236

237237
static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
238238
{
239-
struct intel_community *community;
239+
const struct intel_community *community;
240240
const struct intel_padgroup *padgrp;
241241
unsigned int offset, gpp_offset;
242242
u32 value;
@@ -1368,7 +1368,7 @@ static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
13681368
int ret, i;
13691369

13701370
for (i = 0; i < pctrl->ncommunities; i++) {
1371-
struct intel_community *community = &pctrl->communities[i];
1371+
const struct intel_community *community = &pctrl->communities[i];
13721372

13731373
ret = intel_gpio_add_community_ranges(pctrl, community);
13741374
if (ret) {

drivers/pinctrl/intel/pinctrl-intel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ int intel_pinctrl_probe_by_uid(struct platform_device *pdev);
264264

265265
extern const struct dev_pm_ops intel_pinctrl_pm_ops;
266266

267-
struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
267+
const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
268268

269269
int intel_get_groups_count(struct pinctrl_dev *pctldev);
270270
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);

drivers/pinctrl/intel/pinctrl-lynxpoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
211211
int reg)
212212
{
213213
struct intel_pinctrl *lg = gpiochip_get_data(chip);
214-
struct intel_community *comm;
214+
const struct intel_community *comm;
215215
int reg_offset;
216216

217217
comm = intel_get_community(lg, offset);

0 commit comments

Comments
 (0)