Lines Matching +full:multi +full:-

1 // SPDX-License-Identifier: GPL-2.0+
3 * I2C multi-instantiate driver, pseudo driver to instantiate multiple
4 * i2c-clients from a single fwnode.
61 struct i2c_multi_inst_data *multi; in i2c_multi_inst_probe() local
65 struct device *dev = &pdev->dev; in i2c_multi_inst_probe()
70 match = acpi_match_device(dev->driver->acpi_match_table, dev); in i2c_multi_inst_probe()
73 return -ENODEV; in i2c_multi_inst_probe()
75 inst_data = (const struct i2c_inst_data *)match->driver_data; in i2c_multi_inst_probe()
84 multi = devm_kmalloc(dev, struct_size(multi, clients, ret), GFP_KERNEL); in i2c_multi_inst_probe()
85 if (!multi) in i2c_multi_inst_probe()
86 return -ENOMEM; in i2c_multi_inst_probe()
88 multi->num_clients = ret; in i2c_multi_inst_probe()
90 for (i = 0; i < multi->num_clients && inst_data[i].type; i++) { in i2c_multi_inst_probe()
93 snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), in i2c_multi_inst_probe()
119 multi->clients[i] = i2c_acpi_new_device(dev, i, &board_info); in i2c_multi_inst_probe()
120 if (IS_ERR(multi->clients[i])) { in i2c_multi_inst_probe()
121 ret = PTR_ERR(multi->clients[i]); in i2c_multi_inst_probe()
122 if (ret != -EPROBE_DEFER) in i2c_multi_inst_probe()
123 dev_err(dev, "Error creating i2c-client, idx %d\n", i); in i2c_multi_inst_probe()
127 if (i < multi->num_clients) { in i2c_multi_inst_probe()
129 ret = -ENODEV; in i2c_multi_inst_probe()
133 platform_set_drvdata(pdev, multi); in i2c_multi_inst_probe()
137 while (--i >= 0) in i2c_multi_inst_probe()
138 i2c_unregister_device(multi->clients[i]); in i2c_multi_inst_probe()
145 struct i2c_multi_inst_data *multi = platform_get_drvdata(pdev); in i2c_multi_inst_remove() local
148 for (i = 0; i < multi->num_clients; i++) in i2c_multi_inst_remove()
149 i2c_unregister_device(multi->clients[i]); in i2c_multi_inst_remove()
178 * Note new device-ids must also be added to i2c_multi_instantiate_ids in
191 .name = "I2C multi instantiate pseudo device driver",
199 MODULE_DESCRIPTION("I2C multi instantiate pseudo device driver");