Re: [PATCH v1 1/1] usb: typec: stusb160x: Make use of i2c_get_match_data()

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

 



Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.11 next-20240925]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/usb-typec-stusb160x-Make-use-of-i2c_get_match_data/20240925-223551
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20240925133952.1067949-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] usb: typec: stusb160x: Make use of i2c_get_match_data()
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240926/202409260206.UbcSQv4S-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240926/202409260206.UbcSQv4S-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/202409260206.UbcSQv4S-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/usb/typec/stusb160x.c: In function 'stusb160x_probe':
>> drivers/usb/typec/stusb160x.c:647:44: error: passing argument 1 of 'i2c_get_match_data' from incompatible pointer type [-Wincompatible-pointer-types]
     647 |         regmap_config = i2c_get_match_data(&client->dev);
         |                                            ^~~~~~~~~~~~
         |                                            |
         |                                            struct device *
   In file included from drivers/usb/typec/stusb160x.c:10:
   include/linux/i2c.h:360:57: note: expected 'const struct i2c_client *' but argument is of type 'struct device *'
     360 | const void *i2c_get_match_data(const struct i2c_client *client);
         |                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~


vim +/i2c_get_match_data +647 drivers/usb/typec/stusb160x.c

   633	
   634	static int stusb160x_probe(struct i2c_client *client)
   635	{
   636		const struct regmap_config *regmap_config;
   637		struct stusb160x *chip;
   638		struct fwnode_handle *fwnode;
   639		int ret;
   640	
   641		chip = devm_kzalloc(&client->dev, sizeof(struct stusb160x), GFP_KERNEL);
   642		if (!chip)
   643			return -ENOMEM;
   644	
   645		i2c_set_clientdata(client, chip);
   646	
 > 647		regmap_config = i2c_get_match_data(&client->dev);
   648	
   649		chip->regmap = devm_regmap_init_i2c(client, regmap_config);
   650		if (IS_ERR(chip->regmap)) {
   651			ret = PTR_ERR(chip->regmap);
   652			dev_err(&client->dev,
   653				"Failed to allocate register map:%d\n", ret);
   654			return ret;
   655		}
   656	
   657		chip->dev = &client->dev;
   658	
   659		chip->vsys_supply = devm_regulator_get_optional(chip->dev, "vsys");
   660		if (IS_ERR(chip->vsys_supply)) {
   661			ret = PTR_ERR(chip->vsys_supply);
   662			if (ret != -ENODEV)
   663				return ret;
   664			chip->vsys_supply = NULL;
   665		}
   666	
   667		chip->vdd_supply = devm_regulator_get_optional(chip->dev, "vdd");
   668		if (IS_ERR(chip->vdd_supply)) {
   669			ret = PTR_ERR(chip->vdd_supply);
   670			if (ret != -ENODEV)
   671				return ret;
   672			chip->vdd_supply = NULL;
   673		}
   674	
   675		chip->vconn_supply = devm_regulator_get_optional(chip->dev, "vconn");
   676		if (IS_ERR(chip->vconn_supply)) {
   677			ret = PTR_ERR(chip->vconn_supply);
   678			if (ret != -ENODEV)
   679				return ret;
   680			chip->vconn_supply = NULL;
   681		}
   682	
   683		fwnode = device_get_named_child_node(chip->dev, "connector");
   684		if (!fwnode)
   685			return -ENODEV;
   686	
   687		/*
   688		 * This fwnode has a "compatible" property, but is never populated as a
   689		 * struct device. Instead we simply parse it to read the properties.
   690		 * This it breaks fw_devlink=on. To maintain backward compatibility
   691		 * with existing DT files, we work around this by deleting any
   692		 * fwnode_links to/from this fwnode.
   693		 */
   694		fw_devlink_purge_absent_suppliers(fwnode);
   695	
   696		/*
   697		 * When both VDD and VSYS power supplies are present, the low power
   698		 * supply VSYS is selected when VSYS voltage is above 3.1 V.
   699		 * Otherwise VDD is selected.
   700		 */
   701		if (chip->vdd_supply &&
   702		    (!chip->vsys_supply ||
   703		     (regulator_get_voltage(chip->vsys_supply) <= 3100000)))
   704			chip->main_supply = chip->vdd_supply;
   705		else
   706			chip->main_supply = chip->vsys_supply;
   707	
   708		if (chip->main_supply) {
   709			ret = regulator_enable(chip->main_supply);
   710			if (ret) {
   711				dev_err(chip->dev,
   712					"Failed to enable main supply: %d\n", ret);
   713				goto fwnode_put;
   714			}
   715		}
   716	
   717		/* Get configuration from chip */
   718		ret = stusb160x_get_caps(chip);
   719		if (ret) {
   720			dev_err(chip->dev, "Failed to get port caps: %d\n", ret);
   721			goto main_reg_disable;
   722		}
   723	
   724		/* Get optional re-configuration from device tree */
   725		ret = stusb160x_get_fw_caps(chip, fwnode);
   726		if (ret) {
   727			dev_err(chip->dev, "Failed to get connector caps: %d\n", ret);
   728			goto main_reg_disable;
   729		}
   730	
   731		ret = stusb160x_chip_init(chip);
   732		if (ret) {
   733			dev_err(chip->dev, "Failed to init port: %d\n", ret);
   734			goto main_reg_disable;
   735		}
   736	
   737		chip->port = typec_register_port(chip->dev, &chip->capability);
   738		if (IS_ERR(chip->port)) {
   739			ret = PTR_ERR(chip->port);
   740			goto all_reg_disable;
   741		}
   742	
   743		/*
   744		 * Default power operation mode initialization: will be updated upon
   745		 * attach/detach interrupt
   746		 */
   747		typec_set_pwr_opmode(chip->port, chip->pwr_opmode);
   748	
   749		if (client->irq) {
   750			chip->role_sw = fwnode_usb_role_switch_get(fwnode);
   751			if (IS_ERR(chip->role_sw)) {
   752				ret = dev_err_probe(chip->dev, PTR_ERR(chip->role_sw),
   753						    "Failed to get usb role switch\n");
   754				goto port_unregister;
   755			}
   756	
   757			ret = stusb160x_irq_init(chip, client->irq);
   758			if (ret)
   759				goto role_sw_put;
   760		} else {
   761			/*
   762			 * If Source or Dual power role, need to enable VDD supply
   763			 * providing Vbus if present. In case of interrupt support,
   764			 * VDD supply will be dynamically managed upon attach/detach
   765			 * interrupt.
   766			 */
   767			if (chip->port_type != TYPEC_PORT_SNK && chip->vdd_supply) {
   768				ret = regulator_enable(chip->vdd_supply);
   769				if (ret) {
   770					dev_err(chip->dev,
   771						"Failed to enable VDD supply: %d\n",
   772						ret);
   773					goto port_unregister;
   774				}
   775				chip->vbus_on = true;
   776			}
   777		}
   778	
   779		fwnode_handle_put(fwnode);
   780	
   781		return 0;
   782	
   783	role_sw_put:
   784		if (chip->role_sw)
   785			usb_role_switch_put(chip->role_sw);
   786	port_unregister:
   787		typec_unregister_port(chip->port);
   788	all_reg_disable:
   789		if (stusb160x_get_vconn(chip))
   790			stusb160x_set_vconn(chip, false);
   791	main_reg_disable:
   792		if (chip->main_supply)
   793			regulator_disable(chip->main_supply);
   794	fwnode_put:
   795		fwnode_handle_put(fwnode);
   796	
   797		return ret;
   798	}
   799	

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux