staging: fsl-mc: decouple the mc-bus public headers from dprc.h
authorLaurentiu Tudor <laurentiu.tudor@nxp.com>
Tue, 27 Jun 2017 14:41:24 +0000 (17:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Jun 2017 14:38:52 +0000 (16:38 +0200)
In its current form, the public headers of the mc-bus depend only on a
structure "dprc_obj_desc" defined in dprc.h. Move it to the bus public
header together with its associated defines and, in order to keep the
naming prefixes consistent rename it to "fsl_mc_obj_desc".
This will allow making dprc.h private in future patches.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-mc/bus/dprc-driver.c
drivers/staging/fsl-mc/bus/dprc.c
drivers/staging/fsl-mc/bus/fsl-mc-bus.c
drivers/staging/fsl-mc/bus/fsl-mc-private.h
drivers/staging/fsl-mc/include/dprc.h
drivers/staging/fsl-mc/include/mc.h

index 1765e2ddba11e8fca4747a7280688bc5b133e624..329ab10dcff0049a5bc3172ee97bd99f8723b66f 100644 (file)
 
 #define FSL_MC_DPRC_DRIVER_NAME    "fsl_mc_dprc"
 
-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 dprc_obj_desc *obj_desc)
+                               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);
@@ -37,7 +37,7 @@ static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
 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);
@@ -46,7 +46,7 @@ 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))
@@ -80,7 +80,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) {
@@ -88,7 +88,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;
@@ -106,13 +106,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);
 }
 
-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)
@@ -137,16 +137,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,
@@ -154,7 +154,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);
                }
        }
@@ -173,7 +173,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;
@@ -181,7 +181,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;
@@ -228,7 +228,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
        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,
@@ -255,7 +255,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,
@@ -283,7 +283,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,
index fcf7b4767dc0e5a1f59918af323128dbd221077a..a47f31d5ffe68bee5e0fb87cf43f6c1d4a80bdfb 100644 (file)
@@ -29,6 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include "../include/mc.h"
 #include "../include/mc-sys.h"
 #include "../include/mc-cmd.h"
 #include "../include/dprc.h"
@@ -496,7 +497,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io,
                 u32 cmd_flags,
                 u16 token,
                 int obj_index,
-                struct dprc_obj_desc *obj_desc)
+                struct fsl_mc_obj_desc *obj_desc)
 {
        struct mc_command cmd = { 0 };
        struct dprc_cmd_get_obj *cmd_params;
index 7b48ade1ca9c05ce041a24754c347fd75683ff20..8725a5cbc3aa2b298ca5c1f763a5fd45e1fae27e 100644 (file)
@@ -82,7 +82,7 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)
         * If the object is not 'plugged' don't match.
         * Only exception is the root DPRC, which is a special case.
         */
-       if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0 &&
+       if ((mc_dev->obj_desc.state & FSL_MC_OBJ_STATE_PLUGGED) == 0 &&
            !fsl_mc_is_root_dprc(&mc_dev->dev))
                goto out;
 
@@ -339,7 +339,7 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev,
        int i;
        int error;
        struct resource *regions;
-       struct dprc_obj_desc *obj_desc = &mc_dev->obj_desc;
+       struct fsl_mc_obj_desc *obj_desc = &mc_dev->obj_desc;
        struct device *parent_dev = mc_dev->dev.parent;
        enum dprc_region_type mc_region_type;
 
@@ -432,7 +432,7 @@ static void fsl_mc_device_release(struct device *dev)
 /**
  * Add a newly discovered fsl-mc device to be visible in Linux
  */
-int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
+int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
                      struct fsl_mc_io *mc_io,
                      struct device *parent_dev,
                      struct fsl_mc_device **new_mc_dev)
@@ -534,7 +534,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
        }
 
        /* Objects are coherent, unless 'no shareability' flag set. */
-       if (!(obj_desc->flags & DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY))
+       if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY))
                arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true);
 
        /*
@@ -687,7 +687,7 @@ static int get_mc_addr_translation_ranges(struct device *dev,
  */
 static int fsl_mc_bus_probe(struct platform_device *pdev)
 {
-       struct dprc_obj_desc obj_desc;
+       struct fsl_mc_obj_desc obj_desc;
        int error;
        struct fsl_mc *mc;
        struct fsl_mc_device *mc_bus_dev = NULL;
@@ -746,7 +746,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
                goto error_cleanup_mc_io;
        }
 
-       memset(&obj_desc, 0, sizeof(struct dprc_obj_desc));
+       memset(&obj_desc, 0, sizeof(struct fsl_mc_obj_desc));
        error = dprc_get_api_version(mc_io, 0,
                                     &obj_desc.ver_major,
                                     &obj_desc.ver_minor);
index 01ef932905dea8111383208c7dcfd37326a8469a..7f5406f7590840a462d7bb01800444baef6e3741 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "../include/mc.h"
 
-int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
+int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
                                   struct fsl_mc_io *mc_io,
                                   struct device *parent_dev,
                                   struct fsl_mc_device **new_mc_dev);
index 2f4a7a75a57231a2f087baf8cc576a68bbe2ff1e..21295e4feb04f7ef7e92e2a0db24e8a6bb5e8929 100644 (file)
@@ -39,6 +39,7 @@
  */
 
 struct fsl_mc_io;
+struct fsl_mc_obj_desc;
 
 int dprc_open(struct fsl_mc_io *mc_io,
              u32 cmd_flags,
@@ -167,59 +168,18 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io,
                       u16 token,
                       int *obj_count);
 
-/* Objects Attributes Flags */
-
-/* Opened state - Indicates that an object is open by at least one owner */
-#define DPRC_OBJ_STATE_OPEN            0x00000001
-/* Plugged state - Indicates that the object is plugged */
-#define DPRC_OBJ_STATE_PLUGGED         0x00000002
-
-/**
- * Shareability flag - Object flag indicating no memory shareability.
- * the object generates memory accesses that are non coherent with other
- * masters;
- * user is responsible for proper memory handling through IOMMU configuration.
- */
-#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY      0x0001
-
-/**
- * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj()
- * @type: Type of object: NULL terminated string
- * @id: ID of logical object resource
- * @vendor: Object vendor identifier
- * @ver_major: Major version number
- * @ver_minor:  Minor version number
- * @irq_count: Number of interrupts supported by the object
- * @region_count: Number of mappable regions supported by the object
- * @state: Object state: combination of DPRC_OBJ_STATE_ states
- * @label: Object label
- * @flags: Object's flags
- */
-struct dprc_obj_desc {
-       char type[16];
-       int id;
-       u16 vendor;
-       u16 ver_major;
-       u16 ver_minor;
-       u8 irq_count;
-       u8 region_count;
-       u32 state;
-       char label[16];
-       u16 flags;
-};
-
 int dprc_get_obj(struct fsl_mc_io *mc_io,
                 u32 cmd_flags,
                 u16 token,
                 int obj_index,
-                struct dprc_obj_desc *obj_desc);
+                struct fsl_mc_obj_desc *obj_desc);
 
 int dprc_get_obj_desc(struct fsl_mc_io *mc_io,
                      u32 cmd_flags,
                      u16 token,
                      char *obj_type,
                      int obj_id,
-                     struct dprc_obj_desc *obj_desc);
+                     struct fsl_mc_obj_desc *obj_desc);
 
 int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
                     u32 cmd_flags,
index 1c46c0c2a895a12133480b08fe89cf3d7934d206..60c7067205311a1a7c0d86d61c73bc7176e2f4fe 100644 (file)
@@ -104,6 +104,45 @@ struct fsl_mc_device_irq {
 #define to_fsl_mc_irq(_mc_resource) \
        container_of(_mc_resource, struct fsl_mc_device_irq, resource)
 
+/* Opened state - Indicates that an object is open by at least one owner */
+#define FSL_MC_OBJ_STATE_OPEN          0x00000001
+/* Plugged state - Indicates that the object is plugged */
+#define FSL_MC_OBJ_STATE_PLUGGED       0x00000002
+
+/**
+ * Shareability flag - Object flag indicating no memory shareability.
+ * the object generates memory accesses that are non coherent with other
+ * masters;
+ * user is responsible for proper memory handling through IOMMU configuration.
+ */
+#define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY    0x0001
+
+/**
+ * struct fsl_mc_obj_desc - Object descriptor
+ * @type: Type of object: NULL terminated string
+ * @id: ID of logical object resource
+ * @vendor: Object vendor identifier
+ * @ver_major: Major version number
+ * @ver_minor:  Minor version number
+ * @irq_count: Number of interrupts supported by the object
+ * @region_count: Number of mappable regions supported by the object
+ * @state: Object state: combination of FSL_MC_OBJ_STATE_ states
+ * @label: Object label: NULL terminated string
+ * @flags: Object's flags
+ */
+struct fsl_mc_obj_desc {
+       char type[16];
+       int id;
+       u16 vendor;
+       u16 ver_major;
+       u16 ver_minor;
+       u8 irq_count;
+       u8 region_count;
+       u32 state;
+       char label[16];
+       u16 flags;
+};
+
 /**
  * Bit masks for a MC object device (struct fsl_mc_device) flags
  */
@@ -150,7 +189,7 @@ struct fsl_mc_device {
        u16 icid;
        u16 mc_handle;
        struct fsl_mc_io *mc_io;
-       struct dprc_obj_desc obj_desc;
+       struct fsl_mc_obj_desc obj_desc;
        struct resource *regions;
        struct fsl_mc_device_irq **irqs;
        struct fsl_mc_resource *resource;