Lines Matching defs:shared
1510 * This joins a PHY group and provides a shared storage for all phydevs in
1522 * This will set the shared pointer of the phydev to the shared storage.
1523 * If this is the first call for a this cookie the shared storage will be
1533 struct phy_package_shared *shared;
1540 shared = bus->shared[addr];
1541 if (!shared) {
1543 shared = kzalloc(sizeof(*shared), GFP_KERNEL);
1544 if (!shared)
1547 shared->priv = kzalloc(priv_size, GFP_KERNEL);
1548 if (!shared->priv)
1550 shared->priv_size = priv_size;
1552 shared->addr = addr;
1553 refcount_set(&shared->refcnt, 1);
1554 bus->shared[addr] = shared;
1557 if (priv_size && priv_size != shared->priv_size)
1559 refcount_inc(&shared->refcnt);
1563 phydev->shared = shared;
1568 kfree(shared);
1580 * was the last user of the shared data between the group, this data is
1581 * freed. Resets the phydev->shared pointer to NULL.
1585 struct phy_package_shared *shared = phydev->shared;
1588 if (!shared)
1591 if (refcount_dec_and_mutex_lock(&shared->refcnt, &bus->shared_lock)) {
1592 bus->shared[shared->addr] = NULL;
1594 kfree(shared->priv);
1595 kfree(shared);
1598 phydev->shared = NULL;