diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-11-04 02:05:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-05 16:31:38 +0300 |
commit | 8e5bf9759a06be2251fa96cfd8b412f1808c62f9 (patch) | |
tree | b328e0e1df8dd864946ef0a17f5b25310fa4f3cd /include/drm/drm_simple_kms_helper.h | |
parent | 49463b7f2da1a115404b02c5533bc2c2125833a3 (diff) | |
download | linux-8e5bf9759a06be2251fa96cfd8b412f1808c62f9.tar.xz |
net: dsa: simplify tree reference counting
DSA trees have a refcount used to automatically free the dsa_switch_tree
structure once there is no switch devices inside of it.
The refcount is incremented when a switch is added to the tree, and
decremented when it is removed from it.
But because of kref_init, the refcount is also incremented at
initialization, and when looking up the tree from the list for symmetry.
Thus the current code stores the number of switches plus one, and makes
the switch registration more complex.
To simplify the switch registration function, we reset the refcount to
zero after initialization and don't increment it when looking up a tree.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/drm/drm_simple_kms_helper.h')
0 files changed, 0 insertions, 0 deletions