Skip to content

Commit cf9ff75

Browse files
IoanaCiorneiLi Yang
authored andcommitted
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: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
1 parent 9182ee2 commit cf9ff75

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/soc/fsl/dpio/dpio-driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
176176
if (err)
177177
goto err_register_dpio_irq;
178178

179-
priv->io = dpaa2_io_create(&desc);
179+
priv->io = dpaa2_io_create(&desc, dev);
180180
if (!priv->io) {
181181
dev_err(dev, "dpaa2_io_create failed\n");
182182
err = -ENOMEM;

‎drivers/soc/fsl/dpio/dpio-service.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct dpaa2_io {
2727
/* protect notifications list */
2828
spinlock_t lock_notifications;
2929
struct list_head notifications;
30+
struct device *dev;
3031
};
3132

3233
struct dpaa2_io_store {
@@ -98,13 +99,15 @@ EXPORT_SYMBOL_GPL(dpaa2_io_service_select);
9899
/**
99100
* dpaa2_io_create() - create a dpaa2_io object.
100101
* @desc: the dpaa2_io descriptor
102+
* @dev: the actual DPIO device
101103
*
102104
* Activates a "struct dpaa2_io" corresponding to the given config of an actual
103105
* DPIO object.
104106
*
105107
* Return a valid dpaa2_io object for success, or NULL for failure.
106108
*/
107-
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc)
109+
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
110+
struct device *dev)
108111
{
109112
struct dpaa2_io *obj = kmalloc(sizeof(*obj), GFP_KERNEL);
110113

@@ -146,6 +149,8 @@ struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc)
146149
dpio_by_cpu[desc->cpu] = obj;
147150
spin_unlock(&dpio_list_lock);
148151

152+
obj->dev = dev;
153+
149154
return obj;
150155
}
151156

‎include/soc/fsl/dpaa2-io.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ struct dpaa2_io_desc {
5757
u32 qman_version;
5858
};
5959

60-
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc);
60+
struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
61+
struct device *dev);
6162

6263
void dpaa2_io_down(struct dpaa2_io *d);
6364

0 commit comments

Comments
 (0)