Lines Matching refs:dev
46 * | | dev 1 | | dev 2 | | dev 3 | |
78 * @dev: CDX device
82 int cdx_dev_reset(struct device *dev)
84 struct cdx_device *cdx_dev = to_cdx_device(dev);
90 cdx_drv = to_cdx_driver(dev->driver);
99 dev_err(dev, "cdx device reset failed\n");
111 * @dev: CDX device
119 static int cdx_unregister_device(struct device *dev,
122 struct cdx_device *cdx_dev = to_cdx_device(dev);
130 device_del(&cdx_dev->dev);
131 put_device(&cdx_dev->dev);
146 * @dev: the CDX device structure to match against
152 const struct cdx_device *dev)
155 if ((id->vendor == CDX_ANY_ID || id->vendor == dev->vendor) &&
156 (id->device == CDX_ANY_ID || id->device == dev->device))
164 * @dev: the CDX device structure to match against.
173 cdx_match_id(const struct cdx_device_id *ids, struct cdx_device *dev)
177 if (cdx_match_one_device(ids, dev))
187 * @dev: the cdx device to match against
193 static int cdx_bus_match(struct device *dev, struct device_driver *drv)
195 struct cdx_device *cdx_dev = to_cdx_device(dev);
227 static int cdx_probe(struct device *dev)
229 struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
230 struct cdx_device *cdx_dev = to_cdx_device(dev);
235 dev_err_probe(dev, error, "%s failed\n", __func__);
242 static void cdx_remove(struct device *dev)
244 struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
245 struct cdx_device *cdx_dev = to_cdx_device(dev);
251 static void cdx_shutdown(struct device *dev)
253 struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
254 struct cdx_device *cdx_dev = to_cdx_device(dev);
260 static int cdx_dma_configure(struct device *dev)
262 struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
263 struct cdx_device *cdx_dev = to_cdx_device(dev);
267 ret = of_dma_configure_id(dev, dev->parent->of_node, 0, &input_id);
269 dev_err(dev, "of_dma_configure_id() failed\n");
274 ret = iommu_device_use_default_domain(dev);
276 arch_teardown_dma_ops(dev);
282 static void cdx_dma_cleanup(struct device *dev)
284 struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
287 iommu_device_unuse_default_domain(dev);
293 field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
295 struct cdx_device *cdx_dev = to_cdx_device(dev); \
303 static ssize_t remove_store(struct device *dev,
315 if (device_remove_file_self(dev, attr)) {
318 ret = cdx_unregister_device(dev, NULL);
327 static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
339 ret = cdx_dev_reset(dev);
347 static ssize_t driver_override_store(struct device *dev,
351 struct cdx_device *cdx_dev = to_cdx_device(dev);
354 if (WARN_ON(dev->bus != &cdx_bus_type))
357 ret = driver_set_override(dev, &cdx_dev->driver_override, buf, count);
364 static ssize_t driver_override_show(struct device *dev,
367 struct cdx_device *cdx_dev = to_cdx_device(dev);
405 dev_err(cdx->dev, "cdx bus scanning failed\n");
456 static void cdx_device_release(struct device *dev)
458 struct cdx_device *cdx_dev = to_cdx_device(dev);
466 struct device *parent = cdx->dev;
479 /* Populate CDX dev params */
489 device_initialize(&cdx_dev->dev);
490 cdx_dev->dev.parent = parent;
491 cdx_dev->dev.bus = &cdx_bus_type;
492 cdx_dev->dev.dma_mask = &cdx_dev->dma_mask;
493 cdx_dev->dev.release = cdx_device_release;
496 dev_set_name(&cdx_dev->dev, "cdx-%02x:%02x",
500 ret = device_add(&cdx_dev->dev);
502 dev_err(&cdx_dev->dev,
513 put_device(&cdx_dev->dev);
526 dev_err(cdx->dev,
544 device_for_each_child(cdx->dev, NULL, cdx_unregister_device);