Re: [PATCH 2/2] gpio: arizona: Add support for GPIOs that need to be maintained

From: kbuild test robot
Date: Sat Apr 08 2017 - 00:07:08 EST


Hi Charles,

[auto build test ERROR on gpio/for-next]
[also build test ERROR on v4.11-rc5 next-20170407]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Charles-Keepax/mfd-arizona-Add-GPIO-maintain-state-flag/20170408-111119
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: x86_64-randconfig-x009-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

drivers/gpio/gpio-arizona.c: In function 'arizona_gpio_direction_in':
>> drivers/gpio/gpio-arizona.c:44:3: error: implicit declaration of function 'pm_runtime_mark_last_busy' [-Werror=implicit-function-declaration]
pm_runtime_mark_last_busy(chip->parent);
^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpio/gpio-arizona.c:45:3: error: implicit declaration of function 'pm_runtime_put_autosuspend' [-Werror=implicit-function-declaration]
pm_runtime_put_autosuspend(chip->parent);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpio/gpio-arizona.c: In function 'arizona_gpio_set':
>> drivers/gpio/gpio-arizona.c:93:9: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]
ret = pm_runtime_get_sync(chip->parent);
^~~~~~~~~~~~~~~~~~~
>> drivers/gpio/gpio-arizona.c:96:11: warning: 'return' with a value, in function returning void
return ret;
^~~
drivers/gpio/gpio-arizona.c:82:13: note: declared here
static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
^~~~~~~~~~~~~~~~
drivers/gpio/gpio-arizona.c: In function 'arizona_gpio_probe':
>> drivers/gpio/gpio-arizona.c:185:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]
pm_runtime_enable(&pdev->dev);
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/pm_runtime_mark_last_busy +44 drivers/gpio/gpio-arizona.c

38 int status = arizona_gpio->status[offset];
39
40 status &= (ARIZONA_GP_MAINTAIN | ARIZONA_GP_STATE_OUTPUT);
41 if (status == (ARIZONA_GP_MAINTAIN | ARIZONA_GP_STATE_OUTPUT)) {
42 arizona_gpio->status[offset] &= ~ARIZONA_GP_STATE_OUTPUT;
43
> 44 pm_runtime_mark_last_busy(chip->parent);
> 45 pm_runtime_put_autosuspend(chip->parent);
46 }
47
48 return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
49 ARIZONA_GPN_DIR, ARIZONA_GPN_DIR);
50 }
51
52 static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset)
53 {
54 struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
55 struct arizona *arizona = arizona_gpio->arizona;
56 unsigned int val;
57 int ret;
58
59 ret = regmap_read(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, &val);
60 if (ret < 0)
61 return ret;
62
63 if (val & ARIZONA_GPN_LVL)
64 return 1;
65 else
66 return 0;
67 }
68
69 static int arizona_gpio_direction_out(struct gpio_chip *chip,
70 unsigned offset, int value)
71 {
72 struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
73 struct arizona *arizona = arizona_gpio->arizona;
74
75 if (value)
76 value = ARIZONA_GPN_LVL;
77
78 return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
79 ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value);
80 }
81
82 static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
83 {
84 struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
85 struct arizona *arizona = arizona_gpio->arizona;
86 int status = arizona_gpio->status[offset];
87 int ret;
88
89 status &= (ARIZONA_GP_MAINTAIN | ARIZONA_GP_STATE_OUTPUT);
90 if (status == ARIZONA_GP_MAINTAIN) {
91 arizona_gpio->status[offset] |= ARIZONA_GP_STATE_OUTPUT;
92
> 93 ret = pm_runtime_get_sync(chip->parent);
94 if (ret < 0) {
95 dev_err(chip->parent, "Failed to resume: %d\n", ret);
> 96 return ret;
97 }
98 }
99
100 if (value)
101 value = ARIZONA_GPN_LVL;
102
103 regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
104 ARIZONA_GPN_LVL, value);
105 }
106
107 static int arizona_gpio_of_xlate(struct gpio_chip *chip,
108 const struct of_phandle_args *gpiospec,
109 u32 *flags)
110 {
111 struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
112 u32 offset = gpiospec->args[0];
113 u32 bits = gpiospec->args[1];
114
115 if (gpiospec->args_count < chip->of_gpio_n_cells)
116 return -EINVAL;
117
118 if (offset >= chip->ngpio)
119 return -EINVAL;
120
121 if (flags)
122 *flags = bits & ~ARIZONA_GP_MAINTAIN;
123
124 if (bits & ARIZONA_GP_MAINTAIN)
125 arizona_gpio->status[offset] |= ARIZONA_GP_MAINTAIN;
126
127 return offset;
128 }
129
130 static const struct gpio_chip template_chip = {
131 .label = "arizona",
132 .owner = THIS_MODULE,
133 .direction_input = arizona_gpio_direction_in,
134 .get = arizona_gpio_get,
135 .direction_output = arizona_gpio_direction_out,
136 .set = arizona_gpio_set,
137 .can_sleep = true,
138 .of_xlate = arizona_gpio_of_xlate,
139 .of_gpio_n_cells = 2,
140 };
141
142 static int arizona_gpio_probe(struct platform_device *pdev)
143 {
144 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
145 struct arizona_pdata *pdata = dev_get_platdata(arizona->dev);
146 struct arizona_gpio *arizona_gpio;
147 int ret;
148
149 arizona_gpio = devm_kzalloc(&pdev->dev, sizeof(*arizona_gpio),
150 GFP_KERNEL);
151 if (!arizona_gpio)
152 return -ENOMEM;
153
154 arizona_gpio->arizona = arizona;
155 arizona_gpio->gpio_chip = template_chip;
156 arizona_gpio->gpio_chip.parent = &pdev->dev;
157 #ifdef CONFIG_OF_GPIO
158 arizona_gpio->gpio_chip.of_node = arizona->dev->of_node;
159 #endif
160
161 switch (arizona->type) {
162 case WM5102:
163 case WM5110:
164 case WM8280:
165 case WM8997:
166 case WM8998:
167 case WM1814:
168 arizona_gpio->gpio_chip.ngpio = 5;
169 break;
170 case WM1831:
171 case CS47L24:
172 arizona_gpio->gpio_chip.ngpio = 2;
173 break;
174 default:
175 dev_err(&pdev->dev, "Unknown chip variant %d\n",
176 arizona->type);
177 return -EINVAL;
178 }
179
180 if (pdata && pdata->gpio_base)
181 arizona_gpio->gpio_chip.base = pdata->gpio_base;
182 else
183 arizona_gpio->gpio_chip.base = -1;
184
> 185 pm_runtime_enable(&pdev->dev);
186
187 ret = devm_gpiochip_add_data(&pdev->dev, &arizona_gpio->gpio_chip,
188 arizona_gpio);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip