Skip to content

Commit a2d00f3

Browse files
madalinbucurdavem330
authored andcommitted
soc: fsl: qbman: allow registering a device link for the portal user
Introduce the API required to make sure that the devices that use the QMan portal are unbound when the portal is unbound. Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e414696 commit a2d00f3

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

‎drivers/soc/fsl/qbman/qman.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,19 @@ struct qman_portal *qman_get_affine_portal(int cpu)
17491749
}
17501750
EXPORT_SYMBOL(qman_get_affine_portal);
17511751

1752+
int qman_start_using_portal(struct qman_portal *p, struct device *dev)
1753+
{
1754+
return (!device_link_add(dev, p->config->dev,
1755+
DL_FLAG_AUTOREMOVE_CONSUMER)) ? -EINVAL : 0;
1756+
}
1757+
EXPORT_SYMBOL(qman_start_using_portal);
1758+
1759+
void qman_stop_using_portal(struct qman_portal *p, struct device *dev)
1760+
{
1761+
device_link_remove(dev, p->config->dev);
1762+
}
1763+
EXPORT_SYMBOL(qman_stop_using_portal);
1764+
17521765
int qman_p_poll_dqrr(struct qman_portal *p, unsigned int limit)
17531766
{
17541767
return __poll_portal_fast(p, limit);

‎include/soc/fsl/qman.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define __FSL_QMAN_H
3333

3434
#include <linux/bitops.h>
35+
#include <linux/device.h>
3536

3637
/* Hardware constants */
3738
#define QM_CHANNEL_SWPORTAL0 0
@@ -914,6 +915,23 @@ u16 qman_affine_channel(int cpu);
914915
*/
915916
struct qman_portal *qman_get_affine_portal(int cpu);
916917

918+
/**
919+
* qman_start_using_portal - register a device link for the portal user
920+
* @p: the portal that will be in use
921+
* @dev: the device that will use the portal
922+
*
923+
* Makes sure that the devices that use the portal are unbound when the
924+
* portal is unbound
925+
*/
926+
int qman_start_using_portal(struct qman_portal *p, struct device *dev);
927+
928+
/**
929+
* qman_stop_using_portal - deregister a device link for the portal user
930+
* @p: the portal that will no longer be in use
931+
* @dev: the device that uses the portal
932+
*/
933+
void qman_stop_using_portal(struct qman_portal *p, struct device *dev);
934+
917935
/**
918936
* qman_p_poll_dqrr - process DQRR (fast-path) entries
919937
* @limit: the maximum number of DQRR entries to process

0 commit comments

Comments
 (0)