Commit cf9ff75d authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Li Yang

soc: fsl: dpio: store a backpointer to the device backing the dpaa2_io

Add a new field in the dpaa2_io structure to hold a backpointer to the
actual DPIO device.
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarLi Yang <leoyang.li@nxp.com>
parent 9182ee28
...@@ -176,7 +176,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) ...@@ -176,7 +176,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
if (err) if (err)
goto err_register_dpio_irq; goto err_register_dpio_irq;
priv->io = dpaa2_io_create(&desc); priv->io = dpaa2_io_create(&desc, dev);
if (!priv->io) { if (!priv->io) {
dev_err(dev, "dpaa2_io_create failed\n"); dev_err(dev, "dpaa2_io_create failed\n");
err = -ENOMEM; err = -ENOMEM;
......
...@@ -27,6 +27,7 @@ struct dpaa2_io { ...@@ -27,6 +27,7 @@ struct dpaa2_io {
/* protect notifications list */ /* protect notifications list */
spinlock_t lock_notifications; spinlock_t lock_notifications;
struct list_head notifications; struct list_head notifications;
struct device *dev;
}; };
struct dpaa2_io_store { struct dpaa2_io_store {
...@@ -98,13 +99,15 @@ EXPORT_SYMBOL_GPL(dpaa2_io_service_select); ...@@ -98,13 +99,15 @@ EXPORT_SYMBOL_GPL(dpaa2_io_service_select);
/** /**
* dpaa2_io_create() - create a dpaa2_io object. * dpaa2_io_create() - create a dpaa2_io object.
* @desc: the dpaa2_io descriptor * @desc: the dpaa2_io descriptor
* @dev: the actual DPIO device
* *
* Activates a "struct dpaa2_io" corresponding to the given config of an actual * Activates a "struct dpaa2_io" corresponding to the given config of an actual
* DPIO object. * DPIO object.
* *
* Return a valid dpaa2_io object for success, or NULL for failure. * Return a valid dpaa2_io object for success, or NULL for failure.
*/ */
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc) struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
struct device *dev)
{ {
struct dpaa2_io *obj = kmalloc(sizeof(*obj), GFP_KERNEL); struct dpaa2_io *obj = kmalloc(sizeof(*obj), GFP_KERNEL);
...@@ -146,6 +149,8 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc) ...@@ -146,6 +149,8 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc)
dpio_by_cpu[desc->cpu] = obj; dpio_by_cpu[desc->cpu] = obj;
spin_unlock(&dpio_list_lock); spin_unlock(&dpio_list_lock);
obj->dev = dev;
return obj; return obj;
} }
......
...@@ -57,7 +57,8 @@ struct dpaa2_io_desc { ...@@ -57,7 +57,8 @@ struct dpaa2_io_desc {
u32 qman_version; u32 qman_version;
}; };
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc); struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
struct device *dev);
void dpaa2_io_down(struct dpaa2_io *d); void dpaa2_io_down(struct dpaa2_io *d);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment