Skip to content

Commit 1652e95

Browse files
committed
pinctrl: intel: Constify struct intel_pinctrl parameter
There are a few functions that do not and should not change the state of the pin control object. Constify the respective parameter. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]>
1 parent bda2f1c commit 1652e95

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ struct intel_community_context {
132132
for_each_intel_pad_group(pctrl, community, grp) \
133133
if (grp->gpio_base == INTEL_GPIO_BASE_NOMAP) {} else
134134

135-
const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
135+
const struct intel_community *intel_get_community(const struct intel_pinctrl *pctrl,
136+
unsigned int pin)
136137
{
137138
const struct intel_community *community;
138139

@@ -181,7 +182,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl,
181182
return community->pad_regs + reg + padno * nregs * 4;
182183
}
183184

184-
static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned int pin)
185+
static bool intel_pad_owned_by_host(const struct intel_pinctrl *pctrl, unsigned int pin)
185186
{
186187
const struct intel_community *community;
187188
const struct intel_padgroup *padgrp;
@@ -206,7 +207,7 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned int pi
206207
return !(readl(padown) & PADOWN_MASK(gpp_offset));
207208
}
208209

209-
static bool intel_pad_acpi_mode(struct intel_pinctrl *pctrl, unsigned int pin)
210+
static bool intel_pad_acpi_mode(const struct intel_pinctrl *pctrl, unsigned int pin)
210211
{
211212
const struct intel_community *community;
212213
const struct intel_padgroup *padgrp;
@@ -248,7 +249,7 @@ enum {
248249
PAD_LOCKED_FULL = PAD_LOCKED | PAD_LOCKED_TX,
249250
};
250251

251-
static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
252+
static int intel_pad_locked(const struct intel_pinctrl *pctrl, unsigned int pin)
252253
{
253254
const struct intel_community *community;
254255
const struct intel_padgroup *padgrp;
@@ -286,27 +287,27 @@ static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
286287
return ret;
287288
}
288289

289-
static bool intel_pad_is_unlocked(struct intel_pinctrl *pctrl, unsigned int pin)
290+
static bool intel_pad_is_unlocked(const struct intel_pinctrl *pctrl, unsigned int pin)
290291
{
291292
return (intel_pad_locked(pctrl, pin) & PAD_LOCKED) == PAD_UNLOCKED;
292293
}
293294

294-
static bool intel_pad_usable(struct intel_pinctrl *pctrl, unsigned int pin)
295+
static bool intel_pad_usable(const struct intel_pinctrl *pctrl, unsigned int pin)
295296
{
296297
return intel_pad_owned_by_host(pctrl, pin) && intel_pad_is_unlocked(pctrl, pin);
297298
}
298299

299300
int intel_get_groups_count(struct pinctrl_dev *pctldev)
300301
{
301-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
302+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
302303

303304
return pctrl->soc->ngroups;
304305
}
305306
EXPORT_SYMBOL_NS_GPL(intel_get_groups_count, PINCTRL_INTEL);
306307

307308
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group)
308309
{
309-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
310+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
310311

311312
return pctrl->soc->groups[group].grp.name;
312313
}
@@ -315,7 +316,7 @@ EXPORT_SYMBOL_NS_GPL(intel_get_group_name, PINCTRL_INTEL);
315316
int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
316317
const unsigned int **pins, unsigned int *npins)
317318
{
318-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
319+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
319320

320321
*pins = pctrl->soc->groups[group].grp.pins;
321322
*npins = pctrl->soc->groups[group].grp.npins;
@@ -383,15 +384,15 @@ static const struct pinctrl_ops intel_pinctrl_ops = {
383384

384385
int intel_get_functions_count(struct pinctrl_dev *pctldev)
385386
{
386-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
387+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
387388

388389
return pctrl->soc->nfunctions;
389390
}
390391
EXPORT_SYMBOL_NS_GPL(intel_get_functions_count, PINCTRL_INTEL);
391392

392393
const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function)
393394
{
394-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
395+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
395396

396397
return pctrl->soc->functions[function].func.name;
397398
}
@@ -400,7 +401,7 @@ EXPORT_SYMBOL_NS_GPL(intel_get_function_name, PINCTRL_INTEL);
400401
int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function,
401402
const char * const **groups, unsigned int * const ngroups)
402403
{
403-
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
404+
const struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
404405

405406
*groups = pctrl->soc->functions[function].func.groups;
406407
*ngroups = pctrl->soc->functions[function].func.ngroups;
@@ -952,7 +953,7 @@ static const struct pinctrl_desc intel_pinctrl_desc = {
952953
* Return: a pin number and pointers to the community and pad group, which
953954
* the pin belongs to, or negative error code if translation can't be done.
954955
*/
955-
static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset,
956+
static int intel_gpio_to_pin(const struct intel_pinctrl *pctrl, unsigned int offset,
956957
const struct intel_community **community,
957958
const struct intel_padgroup **padgrp)
958959
{
@@ -982,7 +983,7 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned int offset,
982983
*
983984
* Return: a GPIO offset, or negative error code if translation can't be done.
984985
*/
985-
static int intel_pin_to_gpio(struct intel_pinctrl *pctrl, int pin)
986+
static int intel_pin_to_gpio(const struct intel_pinctrl *pctrl, int pin)
986987
{
987988
const struct intel_community *community;
988989
const struct intel_padgroup *padgrp;

drivers/pinctrl/intel/pinctrl-intel.h

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

265265
extern const struct dev_pm_ops intel_pinctrl_pm_ops;
266266

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

269270
int intel_get_groups_count(struct pinctrl_dev *pctldev);
270271
const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);

0 commit comments

Comments
 (0)