staging: fsl-mc: abstract test for existence of fsl-mc bus
Add function to test for existence of an fsl-mc bus instance instead of doing this by looking directly at a field in the bus type struct. Signed-off-by: Itai Katz <itai.katz@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9f31b69559
commit
14f928054a
|
@ -39,7 +39,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)
|
||||||
bool major_version_mismatch = false;
|
bool major_version_mismatch = false;
|
||||||
bool minor_version_mismatch = false;
|
bool minor_version_mismatch = false;
|
||||||
|
|
||||||
if (WARN_ON(!fsl_mc_bus_type.dev_root))
|
if (WARN_ON(!fsl_mc_bus_exists()))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!mc_drv->match_id_table)
|
if (!mc_drv->match_id_table)
|
||||||
|
@ -206,6 +206,15 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
|
EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fsl_mc_bus_exists - check if a root dprc exists
|
||||||
|
*/
|
||||||
|
bool fsl_mc_bus_exists(void)
|
||||||
|
{
|
||||||
|
return fsl_mc_bus_type.dev_root;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(fsl_mc_bus_exists);
|
||||||
|
|
||||||
static int get_dprc_icid(struct fsl_mc_io *mc_io,
|
static int get_dprc_icid(struct fsl_mc_io *mc_io,
|
||||||
int container_id, u16 *icid)
|
int container_id, u16 *icid)
|
||||||
{
|
{
|
||||||
|
@ -407,7 +416,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
|
||||||
|
|
||||||
mc_io2 = mc_io;
|
mc_io2 = mc_io;
|
||||||
|
|
||||||
if (!fsl_mc_bus_type.dev_root)
|
if (!fsl_mc_bus_exists())
|
||||||
fsl_mc_bus_type.dev_root = &mc_dev->dev;
|
fsl_mc_bus_type.dev_root = &mc_dev->dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,8 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
|
||||||
|
|
||||||
void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
|
void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
|
||||||
|
|
||||||
|
bool fsl_mc_bus_exists(void);
|
||||||
|
|
||||||
int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
|
int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
|
||||||
u16 mc_io_flags,
|
u16 mc_io_flags,
|
||||||
struct fsl_mc_io **new_mc_io);
|
struct fsl_mc_io **new_mc_io);
|
||||||
|
|
Loading…
Reference in New Issue