// SPDX-License-Identifier: GPL-2.0-or-later /* * RapidIO driver support * * Copyright 2005 MontaVista Software, Inc. * Matt Porter <[email protected]> */ #include <linux/init.h> #include <linux/module.h> #include <linux/rio.h> #include <linux/rio_ids.h> #include <linux/rio_drv.h> #include "rio.h" /** * rio_match_device - Tell if a RIO device has a matching RIO device id structure * @id: the RIO device id structure to match against * @rdev: the RIO device structure to match against * * Used from driver probe and bus matching to check whether a RIO device * matches a device id structure provided by a RIO driver. Returns the * matching &struct rio_device_id or %NULL if there is no match. */ static const struct rio_device_id *rio_match_device(const struct rio_device_id *id, const struct rio_dev *rdev) { … } /** * rio_dev_get - Increments the reference count of the RIO device structure * * @rdev: RIO device being referenced * * Each live reference to a device should be refcounted. * * Drivers for RIO devices should normally record such references in * their probe() methods, when they bind to a device, and release * them by calling rio_dev_put(), in their disconnect() methods. */ struct rio_dev *rio_dev_get(struct rio_dev *rdev) { … } /** * rio_dev_put - Release a use of the RIO device structure * * @rdev: RIO device being disconnected * * Must be called when a user of a device is finished with it. * When the last user of the device calls this function, the * memory of the device is freed. */ void rio_dev_put(struct rio_dev *rdev) { … } /** * rio_device_probe - Tell if a RIO device structure has a matching RIO device id structure * @dev: the RIO device structure to match against * * return 0 and set rio_dev->driver when drv claims rio_dev, else error */ static int rio_device_probe(struct device *dev) { … } /** * rio_device_remove - Remove a RIO device from the system * * @dev: the RIO device structure to match against * * Remove a RIO device from the system. If it has an associated * driver, then run the driver remove() method. Then update * the reference count. */ static void rio_device_remove(struct device *dev) { … } static void rio_device_shutdown(struct device *dev) { … } /** * rio_register_driver - register a new RIO driver * @rdrv: the RIO driver structure to register * * Adds a &struct rio_driver to the list of registered drivers. * Returns a negative value on error, otherwise 0. If no error * occurred, the driver remains registered even if no device * was claimed during registration. */ int rio_register_driver(struct rio_driver *rdrv) { … } /** * rio_unregister_driver - unregister a RIO driver * @rdrv: the RIO driver structure to unregister * * Deletes the &struct rio_driver from the list of registered RIO * drivers, gives it a chance to clean up by calling its remove() * function for each device it was responsible for, and marks those * devices as driverless. */ void rio_unregister_driver(struct rio_driver *rdrv) { … } void rio_attach_device(struct rio_dev *rdev) { … } EXPORT_SYMBOL_GPL(…); /** * rio_match_bus - Tell if a RIO device structure has a matching RIO driver device id structure * @dev: the standard device structure to match against * @drv: the standard driver structure containing the ids to match against * * Used by a driver to check whether a RIO device present in the * system is in its list of supported devices. Returns 1 if * there is a matching &struct rio_device_id or 0 if there is * no match. */ static int rio_match_bus(struct device *dev, const struct device_driver *drv) { … } static int rio_uevent(const struct device *dev, struct kobj_uevent_env *env) { … } struct class rio_mport_class = …; EXPORT_SYMBOL_GPL(…); struct bus_type rio_bus_type = …; /** * rio_bus_init - Register the RapidIO bus with the device model * * Registers the RIO mport device class and RIO bus type with the Linux * device model. */ static int __init rio_bus_init(void) { … } postcore_initcall(rio_bus_init); EXPORT_SYMBOL_GPL(…); EXPORT_SYMBOL_GPL(…); EXPORT_SYMBOL_GPL(…); EXPORT_SYMBOL_GPL(…); EXPORT_SYMBOL_GPL(…);