Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: stusb160x: Make use of i2c_get_match_data()

Get matching data in one step by switching to use i2c_get_match_data().
As a positive side effect the matching data is qualified as a constant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240926122944.1251923-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
82375469 d7e75301

+3 -4
+3 -4
drivers/usb/typec/stusb160x.c
··· 633 633 634 634 static int stusb160x_probe(struct i2c_client *client) 635 635 { 636 + const struct regmap_config *regmap_config; 636 637 struct stusb160x *chip; 637 - const struct of_device_id *match; 638 - struct regmap_config *regmap_config; 639 638 struct fwnode_handle *fwnode; 640 639 int ret; 641 640 ··· 644 645 645 646 i2c_set_clientdata(client, chip); 646 647 647 - match = i2c_of_match_device(stusb160x_of_match, client); 648 - regmap_config = (struct regmap_config *)match->data; 648 + regmap_config = i2c_get_match_data(client); 649 + 649 650 chip->regmap = devm_regmap_init_i2c(client, regmap_config); 650 651 if (IS_ERR(chip->regmap)) { 651 652 ret = PTR_ERR(chip->regmap);