diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-01 18:54:26 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-09 15:49:32 +0100 |
commit | fa627348cfc7fb174468d88756b83c2d97890b07 (patch) | |
tree | 3beed87894c45fba3315abcbad6f2e3c67e18b32 /drivers/net | |
parent | 9a6800d1b9da21302758fb37e58b3ab1cadfc643 (diff) | |
download | linux-stable-fa627348cfc7fb174468d88756b83c2d97890b07.tar.gz linux-stable-fa627348cfc7fb174468d88756b83c2d97890b07.tar.bz2 linux-stable-fa627348cfc7fb174468d88756b83c2d97890b07.zip |
driver core: class: make namespace and get_ownership take const *
The callbacks in struct class namespace() and get_ownership() do not
modify the struct device passed to them, so mark the pointer as constant
and fix up all callbacks in the kernel to have the correct function
signature.
This helps make it more obvious what calls and callbacks do, and do not,
modify structures passed to them.
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20221001165426.2690912-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ipvlan/ipvtap.c | 4 | ||||
-rw-r--r-- | drivers/net/macvtap.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index cbabca167a07..dde272586e80 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c @@ -30,9 +30,9 @@ static dev_t ipvtap_major; static struct cdev ipvtap_cdev; -static const void *ipvtap_net_namespace(struct device *d) +static const void *ipvtap_net_namespace(const struct device *d) { - struct net_device *dev = to_net_dev(d->parent); + const struct net_device *dev = to_net_dev(d->parent); return dev_net(dev); } diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index d1f435788e90..031344239f27 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -35,9 +35,9 @@ struct macvtap_dev { */ static dev_t macvtap_major; -static const void *macvtap_net_namespace(struct device *d) +static const void *macvtap_net_namespace(const struct device *d) { - struct net_device *dev = to_net_dev(d->parent); + const struct net_device *dev = to_net_dev(d->parent); return dev_net(dev); } |