if (spi && !spi->dev.of_node && !spi->dev.fwnode)
spi_unregister_device(spi);
}
void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, conststruct v4l2_subdev_ops *ops)
{
v4l2_subdev_init(sd, ops);
sd->flags |= V4L2_SUBDEV_FL_IS_SPI; /* the owner is the same as the spi_device's driver owner */
sd->owner = spi->dev.driver->owner;
sd->dev = &spi->dev; /* spi_device and v4l2_subdev point to one another */
v4l2_set_subdevdata(sd, spi);
spi_set_drvdata(spi, sd); /* initialize name */
snprintf(sd->name, sizeof(sd->name), "%s %s",
spi->dev.driver->name, dev_name(&spi->dev));
}
EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init);
if (!v4l2_dev) return NULL; if (info->modalias[0])
request_module(info->modalias);
spi = spi_new_device(ctlr, info);
if (!spi || !spi->dev.driver) goto error;
if (!try_module_get(spi->dev.driver->owner)) goto error;
sd = spi_get_drvdata(spi);
/* * Register with the v4l2_device which increases the module's * use count as well.
*/ if (__v4l2_device_register_subdev(v4l2_dev, sd, sd->owner))
sd = NULL;
/* Decrease the module use count to match the first try_module_get. */
module_put(spi->dev.driver->owner);
error: /* * If we have a client but no subdev, then something went wrong and * we must unregister the client.
*/ if (!sd)
spi_unregister_device(spi);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.