diff options
Diffstat (limited to 'drivers/staging/fsl-mc/bus/dprc-driver.c')
-rw-r--r-- | drivers/staging/fsl-mc/bus/dprc-driver.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index e4b0341d42d7..4cdd190a338b 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -13,27 +13,30 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/msi.h> -#include "../include/mc-bus.h" -#include "../include/mc-sys.h" +#include "../include/mc.h" #include "dprc-cmd.h" #include "fsl-mc-private.h" #define FSL_MC_DPRC_DRIVER_NAME "fsl_mc_dprc" -#define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc) \ - (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \ - (_mc_dev)->obj_desc.id == (_obj_desc)->id) - -struct dprc_child_objs { +struct fsl_mc_child_objs { int child_count; - struct dprc_obj_desc *child_array; + struct fsl_mc_obj_desc *child_array; }; +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, + struct fsl_mc_obj_desc *obj_desc) +{ + return mc_dev->obj_desc.id == obj_desc->id && + !strcmp(mc_dev->obj_desc.type, obj_desc->type); + +} + static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) { int i; - struct dprc_child_objs *objs; + struct fsl_mc_child_objs *objs; struct fsl_mc_device *mc_dev; WARN_ON(!dev); @@ -42,10 +45,10 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data) objs = data; for (i = 0; i < objs->child_count; i++) { - struct dprc_obj_desc *obj_desc = &objs->child_array[i]; + struct fsl_mc_obj_desc *obj_desc = &objs->child_array[i]; if (strlen(obj_desc->type) != 0 && - FSL_MC_DEVICE_MATCH(mc_dev, obj_desc)) + fsl_mc_device_match(mc_dev, obj_desc)) break; } @@ -76,7 +79,7 @@ static int __fsl_mc_device_remove(struct device *dev, void *data) * been dynamically removed in the physical DPRC. */ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { if (num_child_objects_in_mc != 0) { @@ -84,7 +87,7 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, * Remove child objects that are in the DPRC in Linux, * but not in the MC: */ - struct dprc_child_objs objs; + struct fsl_mc_child_objs objs; objs.child_count = num_child_objects_in_mc; objs.child_array = obj_desc_array; @@ -102,13 +105,13 @@ static void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev, static int __fsl_mc_device_match(struct device *dev, void *data) { - struct dprc_obj_desc *obj_desc = data; + struct fsl_mc_obj_desc *obj_desc = data; struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); - return FSL_MC_DEVICE_MATCH(mc_dev, obj_desc); + return fsl_mc_device_match(mc_dev, obj_desc); } -static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc +static struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc, struct fsl_mc_device *mc_bus_dev) @@ -133,16 +136,16 @@ static struct fsl_mc_device *fsl_mc_device_lookup(struct dprc_obj_desc * device is unbound from the corresponding device driver. */ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, - struct dprc_obj_desc *obj_desc) + struct fsl_mc_obj_desc *obj_desc) { int error; u32 plugged_flag_at_mc = - obj_desc->state & DPRC_OBJ_STATE_PLUGGED; + obj_desc->state & FSL_MC_OBJ_STATE_PLUGGED; if (plugged_flag_at_mc != - (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) { + (mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED)) { if (plugged_flag_at_mc) { - mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state |= FSL_MC_OBJ_STATE_PLUGGED; error = device_attach(&mc_dev->dev); if (error < 0) { dev_err(&mc_dev->dev, @@ -150,7 +153,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, error); } } else { - mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED; + mc_dev->obj_desc.state &= ~FSL_MC_OBJ_STATE_PLUGGED; device_release_driver(&mc_dev->dev); } } @@ -169,7 +172,7 @@ static void check_plugged_state_change(struct fsl_mc_device *mc_dev, * in the physical DPRC. */ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, - struct dprc_obj_desc *obj_desc_array, + struct fsl_mc_obj_desc *obj_desc_array, int num_child_objects_in_mc) { int error; @@ -177,7 +180,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, for (i = 0; i < num_child_objects_in_mc; i++) { struct fsl_mc_device *child_dev; - struct dprc_obj_desc *obj_desc = &obj_desc_array[i]; + struct fsl_mc_obj_desc *obj_desc = &obj_desc_array[i]; if (strlen(obj_desc->type) == 0) continue; @@ -217,14 +220,14 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * populated before they can get allocation requests from probe callbacks * of the device drivers for the non-allocatable devices. */ -int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, - unsigned int *total_irq_count) +static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + unsigned int *total_irq_count) { int num_child_objects; int dprc_get_obj_failures; int error; unsigned int irq_count = mc_bus_dev->obj_desc.irq_count; - struct dprc_obj_desc *child_obj_desc_array = NULL; + struct fsl_mc_obj_desc *child_obj_desc_array = NULL; error = dprc_get_obj_count(mc_bus_dev->mc_io, 0, @@ -251,7 +254,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, */ dprc_get_obj_failures = 0; for (i = 0; i < num_child_objects; i++) { - struct dprc_obj_desc *obj_desc = + struct fsl_mc_obj_desc *obj_desc = &child_obj_desc_array[i]; error = dprc_get_obj(mc_bus_dev->mc_io, @@ -279,7 +282,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, if ((strcmp(obj_desc->type, "dpseci") == 0) && (obj_desc->ver_major < 4)) obj_desc->flags |= - DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY; + FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY; irq_count += obj_desc->irq_count; dev_dbg(&mc_bus_dev->dev, @@ -306,7 +309,6 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, return 0; } -EXPORT_SYMBOL_GPL(dprc_scan_objects); /** * dprc_scan_container - Scans a physical DPRC and synchronizes Linux bus state @@ -317,7 +319,7 @@ EXPORT_SYMBOL_GPL(dprc_scan_objects); * bus driver with the actual state of the MC by adding and removing * devices as appropriate. */ -int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) +static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) { int error; unsigned int irq_count; @@ -353,7 +355,6 @@ error: fsl_mc_cleanup_all_resource_pools(mc_bus_dev); return error; } -EXPORT_SYMBOL_GPL(dprc_scan_container); /** * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 @@ -681,8 +682,8 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) } if (major_ver < DPRC_MIN_VER_MAJOR || - (major_ver == DPRC_MIN_VER_MAJOR && - minor_ver < DPRC_MIN_VER_MINOR)) { + (major_ver == DPRC_MIN_VER_MAJOR && + minor_ver < DPRC_MIN_VER_MINOR)) { dev_err(&mc_dev->dev, "ERROR: DPRC version %d.%d not supported\n", major_ver, minor_ver); |