Lines Matching full:smi

43 struct smi {  struct
84 static void smi_devs_unregister(struct smi *smi) in smi_devs_unregister() argument
87 while (smi->i2c_num--) in smi_devs_unregister()
88 i2c_unregister_device(smi->i2c_devs[smi->i2c_num]); in smi_devs_unregister()
92 while (smi->spi_num--) in smi_devs_unregister()
93 spi_unregister_device(smi->spi_devs[smi->spi_num]); in smi_devs_unregister()
100 * @smi: Internal struct for Serial multi instantiate driver
105 static int smi_spi_probe(struct platform_device *pdev, struct smi *smi, in smi_spi_probe() argument
123 smi->spi_devs = devm_kcalloc(dev, count, sizeof(*smi->spi_devs), GFP_KERNEL); in smi_spi_probe()
124 if (!smi->spi_devs) in smi_spi_probe()
162 smi->spi_devs[i] = spi_dev; in smi_spi_probe()
163 smi->spi_num++; in smi_spi_probe()
166 if (smi->spi_num < count) { in smi_spi_probe()
172 dev_info(dev, "Instantiated %d SPI devices.\n", smi->spi_num); in smi_spi_probe()
176 smi_devs_unregister(smi); in smi_spi_probe()
184 * @smi: Internal struct for Serial multi instantiate driver
189 static int smi_i2c_probe(struct platform_device *pdev, struct smi *smi, in smi_i2c_probe() argument
206 smi->i2c_devs = devm_kcalloc(dev, count, sizeof(*smi->i2c_devs), GFP_KERNEL); in smi_i2c_probe()
207 if (!smi->i2c_devs) in smi_i2c_probe()
221 smi->i2c_devs[i] = i2c_acpi_new_device(dev, i, &board_info); in smi_i2c_probe()
222 if (IS_ERR(smi->i2c_devs[i])) { in smi_i2c_probe()
223 ret = dev_err_probe(dev, PTR_ERR(smi->i2c_devs[i]), in smi_i2c_probe()
227 smi->i2c_num++; in smi_i2c_probe()
229 if (smi->i2c_num < count) { in smi_i2c_probe()
235 dev_info(dev, "Instantiated %d I2C devices.\n", smi->i2c_num); in smi_i2c_probe()
239 smi_devs_unregister(smi); in smi_i2c_probe()
248 struct smi *smi; in smi_probe() local
257 smi = devm_kzalloc(dev, sizeof(*smi), GFP_KERNEL); in smi_probe()
258 if (!smi) in smi_probe()
261 platform_set_drvdata(pdev, smi); in smi_probe()
266 return smi_i2c_probe(pdev, smi, node->instances); in smi_probe()
271 return smi_spi_probe(pdev, smi, node->instances); in smi_probe()
284 ret = smi_i2c_probe(pdev, smi, node->instances); in smi_probe()
290 return smi_spi_probe(pdev, smi, node->instances); in smi_probe()
300 struct smi *smi = platform_get_drvdata(pdev); in smi_remove() local
302 smi_devs_unregister(smi); in smi_remove()