Lines Matching defs:shared
1656 * This joins a PHY group and provides a shared storage for all phydevs in
1668 * This will set the shared pointer of the phydev to the shared storage.
1669 * If this is the first call for a this cookie the shared storage will be
1679 struct phy_package_shared *shared;
1686 shared = bus->shared[addr];
1687 if (!shared) {
1689 shared = kzalloc(sizeof(*shared), GFP_KERNEL);
1690 if (!shared)
1693 shared->priv = kzalloc(priv_size, GFP_KERNEL);
1694 if (!shared->priv)
1696 shared->priv_size = priv_size;
1698 shared->addr = addr;
1699 refcount_set(&shared->refcnt, 1);
1700 bus->shared[addr] = shared;
1703 if (priv_size && priv_size != shared->priv_size)
1705 refcount_inc(&shared->refcnt);
1709 phydev->shared = shared;
1714 kfree(shared);
1726 * was the last user of the shared data between the group, this data is
1727 * freed. Resets the phydev->shared pointer to NULL.
1731 struct phy_package_shared *shared = phydev->shared;
1734 if (!shared)
1737 if (refcount_dec_and_mutex_lock(&shared->refcnt, &bus->shared_lock)) {
1738 bus->shared[shared->addr] = NULL;
1740 kfree(shared->priv);
1741 kfree(shared);
1744 phydev->shared = NULL;