[lee-leds:for-leds-next 7/10] drivers/leds/leds-pca955x.c:509:15: error: implicit declaration of function 'pca955x_num_led_regs'; did you mean 'pca955x_num_input_regs'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
head:   2f372a5dce6885f1d2647f7add01756bee0fef49
commit: 14ef0738a31dcecfbba38626884b7d9a60b75cd0 [7/10] leds: pca955x: Optimize probe LED selection
config: i386-buildonly-randconfig-001-20250221 (https://download.01.org/0day-ci/archive/20250221/202502210631.1wjjGDNd-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250221/202502210631.1wjjGDNd-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502210631.1wjjGDNd-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/leds/leds-pca955x.c: In function 'pca955x_probe':
>> drivers/leds/leds-pca955x.c:509:15: error: implicit declaration of function 'pca955x_num_led_regs'; did you mean 'pca955x_num_input_regs'? [-Werror=implicit-function-declaration]
     509 |         nls = pca955x_num_led_regs(chip->bits);
         |               ^~~~~~~~~~~~~~~~~~~~
         |               pca955x_num_input_regs
   cc1: some warnings being treated as errors


vim +509 drivers/leds/leds-pca955x.c

   440	
   441	static int pca955x_probe(struct i2c_client *client)
   442	{
   443		struct pca955x *pca955x;
   444		struct pca955x_led *pca955x_led;
   445		const struct pca955x_chipdef *chip;
   446		struct led_classdev *led;
   447		struct led_init_data init_data;
   448		struct i2c_adapter *adapter;
   449		int i, bit, err, nls, reg;
   450		u8 ls1[4];
   451		u8 ls2[4];
   452		struct pca955x_platform_data *pdata;
   453		bool set_default_label = false;
   454		bool keep_pwm = false;
   455		char default_label[8];
   456	
   457		chip = i2c_get_match_data(client);
   458		if (!chip)
   459			return dev_err_probe(&client->dev, -ENODEV, "unknown chip\n");
   460	
   461		adapter = client->adapter;
   462		pdata = dev_get_platdata(&client->dev);
   463		if (!pdata) {
   464			pdata =	pca955x_get_pdata(client, chip);
   465			if (IS_ERR(pdata))
   466				return PTR_ERR(pdata);
   467		}
   468	
   469		/* Make sure the slave address / chip type combo given is possible */
   470		if ((client->addr & ~((1 << chip->slv_addr_shift) - 1)) !=
   471		    chip->slv_addr) {
   472			dev_err(&client->dev, "invalid slave address %02x\n",
   473				client->addr);
   474			return -ENODEV;
   475		}
   476	
   477		dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at "
   478			 "slave address 0x%02x\n", client->name, chip->bits,
   479			 client->addr);
   480	
   481		if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
   482			return -EIO;
   483	
   484		if (pdata->num_leds != chip->bits) {
   485			dev_err(&client->dev,
   486				"board info claims %d LEDs on a %d-bit chip\n",
   487				pdata->num_leds, chip->bits);
   488			return -ENODEV;
   489		}
   490	
   491		pca955x = devm_kzalloc(&client->dev, sizeof(*pca955x), GFP_KERNEL);
   492		if (!pca955x)
   493			return -ENOMEM;
   494	
   495		pca955x->leds = devm_kcalloc(&client->dev, chip->bits,
   496					     sizeof(*pca955x_led), GFP_KERNEL);
   497		if (!pca955x->leds)
   498			return -ENOMEM;
   499	
   500		i2c_set_clientdata(client, pca955x);
   501	
   502		mutex_init(&pca955x->lock);
   503		pca955x->client = client;
   504		pca955x->chipdef = chip;
   505	
   506		init_data.devname_mandatory = false;
   507		init_data.devicename = "pca955x";
   508	
 > 509		nls = pca955x_num_led_regs(chip->bits);
   510		/* Use auto-increment feature to read all the LED selectors at once. */
   511		err = i2c_smbus_read_i2c_block_data(client,
   512						    0x10 | (pca955x_num_input_regs(chip->bits) + 4), nls,
   513						    ls1);
   514		if (err < 0)
   515			return err;
   516	
   517		for (i = 0; i < nls; i++)
   518			ls2[i] = ls1[i];
   519	
   520		for (i = 0; i < chip->bits; i++) {
   521			pca955x_led = &pca955x->leds[i];
   522			pca955x_led->led_num = i;
   523			pca955x_led->pca955x = pca955x;
   524			pca955x_led->type = pdata->leds[i].type;
   525	
   526			switch (pca955x_led->type) {
   527			case PCA955X_TYPE_NONE:
   528			case PCA955X_TYPE_GPIO:
   529				break;
   530			case PCA955X_TYPE_LED:
   531				bit = i % 4;
   532				reg = i / 4;
   533				led = &pca955x_led->led_cdev;
   534				led->brightness_set_blocking = pca955x_led_set;
   535				led->brightness_get = pca955x_led_get;
   536	
   537				if (pdata->leds[i].default_state == LEDS_DEFSTATE_OFF)
   538					ls2[reg] = pca955x_ledsel(ls2[reg], bit, PCA955X_LS_LED_OFF);
   539				else if (pdata->leds[i].default_state == LEDS_DEFSTATE_ON)
   540					ls2[reg] = pca955x_ledsel(ls2[reg], bit, PCA955X_LS_LED_ON);
   541	
   542				init_data.fwnode = pdata->leds[i].fwnode;
   543	
   544				if (is_of_node(init_data.fwnode)) {
   545					if (to_of_node(init_data.fwnode)->name[0] ==
   546					    '\0')
   547						set_default_label = true;
   548					else
   549						set_default_label = false;
   550				} else {
   551					set_default_label = true;
   552				}
   553	
   554				if (set_default_label) {
   555					snprintf(default_label, sizeof(default_label),
   556						 "%d", i);
   557					init_data.default_label = default_label;
   558				} else {
   559					init_data.default_label = NULL;
   560				}
   561	
   562				err = devm_led_classdev_register_ext(&client->dev, led,
   563								     &init_data);
   564				if (err)
   565					return err;
   566	
   567				set_bit(i, &pca955x->active_pins);
   568	
   569				/*
   570				 * For default-state == "keep", let the core update the
   571				 * brightness from the hardware, then check the
   572				 * brightness to see if it's using PWM1. If so, PWM1
   573				 * should not be written below.
   574				 */
   575				if (pdata->leds[i].default_state == LEDS_DEFSTATE_KEEP) {
   576					if (led->brightness != LED_FULL &&
   577					    led->brightness != LED_OFF &&
   578					    led->brightness != LED_HALF)
   579						keep_pwm = true;
   580				}
   581			}
   582		}
   583	
   584		for (i = 0; i < nls; i++) {
   585			if (ls1[i] != ls2[i]) {
   586				err = pca955x_write_ls(pca955x, i, ls2[i]);
   587				if (err)
   588					return err;
   589			}
   590		}
   591	
   592		/* PWM0 is used for half brightness or 50% duty cycle */
   593		err = pca955x_write_pwm(pca955x, 0, 255 - LED_HALF);
   594		if (err)
   595			return err;
   596	
   597		if (!keep_pwm) {
   598			/* PWM1 is used for variable brightness, default to OFF */
   599			err = pca955x_write_pwm(pca955x, 1, 0);
   600			if (err)
   601				return err;
   602		}
   603	
   604		/* Set to fast frequency so we do not see flashing */
   605		err = pca955x_write_psc(pca955x, 0, 0);
   606		if (err)
   607			return err;
   608		err = pca955x_write_psc(pca955x, 1, 0);
   609		if (err)
   610			return err;
   611	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux