tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-driver-h head: 3f3eb02404a7eba890f4f18e2ad1a296dfcb586d commit: 9d9f235bdaa15cf19b9b415a4f3c852a03ee2b00 [67/71] gpio: pca953x: Include the right header config: i386-randconfig-s1-201820 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: git checkout 9d9f235bdaa15cf19b9b415a4f3c852a03ee2b00 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers//gpio/gpio-pca953x.c:150:19: error: field 'gpio_chip' has incomplete type struct gpio_chip gpio_chip; ^~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_direction_input': >> drivers//gpio/gpio-pca953x.c:291:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror=implicit-function-declaration] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c:291:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_direction_output': drivers//gpio/gpio-pca953x.c:311:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_get_value': drivers//gpio/gpio-pca953x.c:344:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_set_value': drivers//gpio/gpio-pca953x.c:364:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_get_direction': drivers//gpio/gpio-pca953x.c:387:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_gpio_set_multiple': drivers//gpio/gpio-pca953x.c:403:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion] struct pca953x_chip *chip = gpiochip_get_data(gc); ^~~~~~~~~~~~~~~~~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_setup_gpio': drivers//gpio/gpio-pca953x.c:441:4: error: dereferencing pointer to incomplete type 'struct gpio_chip' gc->direction_input = pca953x_gpio_direction_input; ^~ drivers//gpio/gpio-pca953x.c: In function 'pca953x_probe': >> drivers//gpio/gpio-pca953x.c:901:8: error: implicit declaration of function 'devm_gpiochip_add_data' [-Werror=implicit-function-declaration] ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); ^~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/gpiochip_get_data +291 drivers//gpio/gpio-pca953x.c 89ea8bbe9 drivers/gpio/pca953x.c Marc Zyngier 2010-03-05 148 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 149 struct i2c_client *client; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 @150 struct gpio_chip gpio_chip; 62154991a drivers/gpio/pca953x.c Uwe Kleine-König 2010-05-26 151 const char *const *names; c6664149a drivers/gpio/gpio-pca953x.c Andy Shevchenko 2015-10-01 152 unsigned long driver_data; e23efa311 drivers/gpio/gpio-pca953x.c Phil Reid 2016-07-29 153 struct regulator *regulator; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 154 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 155 const struct pca953x_reg_config *regs; 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 156 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 157 int (*write_regs)(struct pca953x_chip *, int, u8 *); c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 158 int (*read_regs)(struct pca953x_chip *, int, u8 *); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 159 }; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 160 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 161 static int pca953x_read_single(struct pca953x_chip *chip, int reg, u32 *val, f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 162 int off) f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 163 { f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 164 int ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 165 int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 166 int offset = off / BANK_SZ; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 167 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 168 ret = i2c_smbus_read_byte_data(chip->client, f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 169 (reg << bank_shift) + offset); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 170 *val = ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 171 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 172 if (ret < 0) { f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 173 dev_err(&chip->client->dev, "failed reading register\n"); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 174 return ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 175 } f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 176 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 177 return 0; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 178 } f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 179 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 180 static int pca953x_write_single(struct pca953x_chip *chip, int reg, u32 val, f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 181 int off) f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 182 { 8c7a92dad drivers/gpio/gpio-pca953x.c Andy Shevchenko 2016-05-31 183 int ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 184 int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 185 int offset = off / BANK_SZ; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 186 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 187 ret = i2c_smbus_write_byte_data(chip->client, f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 188 (reg << bank_shift) + offset, val); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 189 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 190 if (ret < 0) { f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 191 dev_err(&chip->client->dev, "failed writing register\n"); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 192 return ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 193 } f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 194 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 195 return 0; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 196 } f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 197 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 198 static int pca953x_write_regs_8(struct pca953x_chip *chip, int reg, u8 *val) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 199 { 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 200 return i2c_smbus_write_byte_data(chip->client, reg, *val); 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 201 } f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 202 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 203 static int pca953x_write_regs_16(struct pca953x_chip *chip, int reg, u8 *val) 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 204 { b2dc4110c drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-07-03 205 u16 word = get_unaligned((u16 *)val); c4d1cbd7c drivers/gpio/gpio-pca953x.c Andy Shevchenko 2016-05-31 206 b2dc4110c drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-07-03 207 return i2c_smbus_write_word_data(chip->client, reg << 1, word); c4d1cbd7c drivers/gpio/gpio-pca953x.c Andy Shevchenko 2016-05-31 208 } 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 209 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 210 static int pca957x_write_regs_16(struct pca953x_chip *chip, int reg, u8 *val) 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 211 { 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 212 int ret; 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 213 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 214 ret = i2c_smbus_write_byte_data(chip->client, reg << 1, val[0]); 33226ffd0 drivers/gpio/pca953x.c Haojian Zhuang 2011-04-18 215 if (ret < 0) 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 216 return ret; 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 217 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 218 return i2c_smbus_write_byte_data(chip->client, (reg << 1) + 1, val[1]); 33226ffd0 drivers/gpio/pca953x.c Haojian Zhuang 2011-04-18 219 } 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 220 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 221 static int pca953x_write_regs_24(struct pca953x_chip *chip, int reg, u8 *val) 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 222 { 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 223 int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 224 int addr = (reg & PCAL_GPIO_MASK) << bank_shift; d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 225 int pinctrl = (reg & PCAL_PINCTRL_MASK) << 1; 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 226 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 227 return i2c_smbus_write_i2c_block_data(chip->client, d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 228 pinctrl | addr | REG_ADDR_AI, 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 229 NBANK(chip), val); 33226ffd0 drivers/gpio/pca953x.c Haojian Zhuang 2011-04-18 230 } f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 231 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 232 static int pca953x_write_regs(struct pca953x_chip *chip, int reg, u8 *val) 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 233 { 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 234 int ret = 0; 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 235 7acc66e37 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 236 ret = chip->write_regs(chip, reg, val); f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 237 if (ret < 0) { f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 238 dev_err(&chip->client->dev, "failed writing register\n"); ab5dc3720 drivers/gpio/pca953x.c David Brownell 2009-01-06 239 return ret; f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 240 } f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 241 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 242 return 0; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 243 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 244 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 245 static int pca953x_read_regs_8(struct pca953x_chip *chip, int reg, u8 *val) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 246 { 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 247 int ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 248 f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 249 ret = i2c_smbus_read_byte_data(chip->client, reg); 96b70641b drivers/gpio/gpio-pca953x.c Andreas Schallenberg 2012-05-21 250 *val = ret; f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 251 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 252 return ret; c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 253 } c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 254 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 255 static int pca953x_read_regs_16(struct pca953x_chip *chip, int reg, u8 *val) c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 256 { c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 257 int ret; c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 258 f5e8ff483 drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 259 ret = i2c_smbus_read_word_data(chip->client, reg << 1); b2dc4110c drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-07-03 260 put_unaligned(ret, (u16 *)val); c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 261 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 262 return ret; 96b70641b drivers/gpio/gpio-pca953x.c Andreas Schallenberg 2012-05-21 263 } c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 264 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 265 static int pca953x_read_regs_24(struct pca953x_chip *chip, int reg, u8 *val) c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 266 { c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 267 int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 268 int addr = (reg & PCAL_GPIO_MASK) << bank_shift; d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 269 int pinctrl = (reg & PCAL_PINCTRL_MASK) << 1; c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 270 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 271 return i2c_smbus_read_i2c_block_data(chip->client, d5dbf9c26 drivers/gpio/gpio-pca953x.c H. Nikolaus Schaller 2018-05-17 272 pinctrl | addr | REG_ADDR_AI, c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 273 NBANK(chip), val); c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 274 } c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 275 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 276 static int pca953x_read_regs(struct pca953x_chip *chip, int reg, u8 *val) c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 277 { c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 278 int ret; c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 279 c6e3cf01d drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 280 ret = chip->read_regs(chip, reg, val); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 281 if (ret < 0) { 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 282 dev_err(&chip->client->dev, "failed reading register\n"); ab5dc3720 drivers/gpio/pca953x.c David Brownell 2009-01-06 283 return ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 284 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 285 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 286 return 0; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 287 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 288 f3dc3630f drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 289 static int pca953x_gpio_direction_input(struct gpio_chip *gc, unsigned off) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 290 { 468e67f6e drivers/gpio/gpio-pca953x.c Linus Walleij 2015-12-07 @291 struct pca953x_chip *chip = gpiochip_get_data(gc); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 292 u8 reg_val; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 293 int ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 294 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 295 mutex_lock(&chip->i2c_lock); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 296 reg_val = chip->reg_direction[off / BANK_SZ] | (1u << (off % BANK_SZ)); 33226ffd0 drivers/gpio/pca953x.c Haojian Zhuang 2011-04-18 297 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 298 ret = pca953x_write_single(chip, chip->regs->direction, reg_val, off); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 299 if (ret) 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 300 goto exit; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 301 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 302 chip->reg_direction[off / BANK_SZ] = reg_val; 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 303 exit: 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 304 mutex_unlock(&chip->i2c_lock); 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 305 return ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 306 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 307 f3dc3630f drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 308 static int pca953x_gpio_direction_output(struct gpio_chip *gc, 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 309 unsigned off, int val) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 310 { 468e67f6e drivers/gpio/gpio-pca953x.c Linus Walleij 2015-12-07 311 struct pca953x_chip *chip = gpiochip_get_data(gc); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 312 u8 reg_val; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 313 int ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 314 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 315 mutex_lock(&chip->i2c_lock); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 316 /* set output level */ 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 317 if (val) f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 318 reg_val = chip->reg_output[off / BANK_SZ] f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 319 | (1u << (off % BANK_SZ)); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 320 else f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 321 reg_val = chip->reg_output[off / BANK_SZ] f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 322 & ~(1u << (off % BANK_SZ)); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 323 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 324 ret = pca953x_write_single(chip, chip->regs->output, reg_val, off); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 325 if (ret) 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 326 goto exit; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 327 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 328 chip->reg_output[off / BANK_SZ] = reg_val; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 329 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 330 /* then direction */ f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 331 reg_val = chip->reg_direction[off / BANK_SZ] & ~(1u << (off % BANK_SZ)); 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 332 ret = pca953x_write_single(chip, chip->regs->direction, reg_val, off); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 333 if (ret) 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 334 goto exit; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 335 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 336 chip->reg_direction[off / BANK_SZ] = reg_val; 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 337 exit: 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 338 mutex_unlock(&chip->i2c_lock); 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 339 return ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 340 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 341 f3dc3630f drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 342 static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 343 { 468e67f6e drivers/gpio/gpio-pca953x.c Linus Walleij 2015-12-07 344 struct pca953x_chip *chip = gpiochip_get_data(gc); ae79c1904 drivers/gpio/gpio-pca953x.c Andreas Schallenberg 2012-05-09 345 u32 reg_val; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 346 int ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 347 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 348 mutex_lock(&chip->i2c_lock); 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 349 ret = pca953x_read_single(chip, chip->regs->input, ®_val, off); 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 350 mutex_unlock(&chip->i2c_lock); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 351 if (ret < 0) { 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 352 /* NOTE: diagnostic already emitted; that's all we should 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 353 * do unless gpio_*_value_cansleep() calls become different 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 354 * from their nonsleeping siblings (and report faults). 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 355 */ 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 356 return 0; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 357 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 358 40a625daa drivers/gpio/gpio-pca953x.c Andrew Ruder 2013-08-07 359 return (reg_val & (1u << (off % BANK_SZ))) ? 1 : 0; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 360 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 361 f3dc3630f drivers/gpio/pca953x.c Guennadi Liakhovetski 2008-02-06 362 static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 363 { 468e67f6e drivers/gpio/gpio-pca953x.c Linus Walleij 2015-12-07 364 struct pca953x_chip *chip = gpiochip_get_data(gc); f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 365 u8 reg_val; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 366 int ret; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 367 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 368 mutex_lock(&chip->i2c_lock); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 369 if (val) f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 370 reg_val = chip->reg_output[off / BANK_SZ] f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 371 | (1u << (off % BANK_SZ)); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 372 else f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 373 reg_val = chip->reg_output[off / BANK_SZ] f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 374 & ~(1u << (off % BANK_SZ)); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 375 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 376 ret = pca953x_write_single(chip, chip->regs->output, reg_val, off); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 377 if (ret) 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 378 goto exit; 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 379 f5f0b7aa8 drivers/gpio/gpio-pca953x.c Gregory CLEMENT 2013-01-22 380 chip->reg_output[off / BANK_SZ] = reg_val; 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 381 exit: 6e20fb180 drivers/gpio/pca953x.c Roland Stigge 2011-02-10 382 mutex_unlock(&chip->i2c_lock); 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 383 } 9e60fdcf0 drivers/gpio/pca9539.c eric miao 2008-02-04 384 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 385 static int pca953x_gpio_get_direction(struct gpio_chip *gc, unsigned off) 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 386 { 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 387 struct pca953x_chip *chip = gpiochip_get_data(gc); 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 388 u32 reg_val; 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 389 int ret; 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 390 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 391 mutex_lock(&chip->i2c_lock); 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 392 ret = pca953x_read_single(chip, chip->regs->direction, ®_val, off); 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 393 mutex_unlock(&chip->i2c_lock); 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 394 if (ret < 0) 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 395 return ret; 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 396 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 397 return !!(reg_val & (1u << (off % BANK_SZ))); 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 398 } 66e571923 drivers/gpio/gpio-pca953x.c Andy Shevchenko 2017-03-22 399 b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 400 static void pca953x_gpio_set_multiple(struct gpio_chip *gc, b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 401 unsigned long *mask, unsigned long *bits) b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 402 { 468e67f6e drivers/gpio/gpio-pca953x.c Linus Walleij 2015-12-07 @403 struct pca953x_chip *chip = gpiochip_get_data(gc); ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 404 unsigned int bank_mask, bank_val; ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 405 int bank_shift, bank; b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 406 u8 reg_val[MAX_BANK]; 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 407 int ret; ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 408 ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 409 bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 410 b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 411 mutex_lock(&chip->i2c_lock); 386377b54 drivers/gpio/gpio-pca953x.c Phil Reid 2016-11-08 412 memcpy(reg_val, chip->reg_output, NBANK(chip)); b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 413 for (bank = 0; bank < NBANK(chip); bank++) { ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 414 bank_mask = mask[bank / sizeof(*mask)] >> e0a8604f1 drivers/gpio/gpio-pca953x.c Geert Uytterhoeven 2016-03-11 415 ((bank % sizeof(*mask)) * 8); ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 416 if (bank_mask) { ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 417 bank_val = bits[bank / sizeof(*bits)] >> e0a8604f1 drivers/gpio/gpio-pca953x.c Geert Uytterhoeven 2016-03-11 418 ((bank % sizeof(*bits)) * 8); 53f8d3222 drivers/gpio/gpio-pca953x.c Phil Reid 2016-11-08 419 bank_val &= bank_mask; ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 420 reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val; b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 421 } b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 422 } ea3d579d8 drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 423 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 424 ret = i2c_smbus_write_i2c_block_data(chip->client, 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 425 chip->regs->output << bank_shift, 53661f3bc drivers/gpio/gpio-pca953x.c Bartosz Golaszewski 2016-09-09 426 NBANK(chip), reg_val); b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 427 if (ret) b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 428 goto exit; b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 429 b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 430 memcpy(chip->reg_output, reg_val, NBANK(chip)); b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 431 exit: b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 432 mutex_unlock(&chip->i2c_lock); b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 433 } b4818afea drivers/gpio/gpio-pca953x.c Phil Reid 2015-12-04 434 :::::: The code at line 291 was first introduced by commit :::::: 468e67f6eb7494e3c4d4d644f281d0ba0cc265c6 gpio: pca953x: use gpiochip data pointer :::::: TO: Linus Walleij <linus.walleij@xxxxxxxxxx> :::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip