diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-09-08 14:16:13 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-13 13:30:47 -0400 |
commit | 76fd85937097a0c2ec8ab23bf21dc10992d1c398 (patch) | |
tree | 0a3dfbacda717b9c55dfd25f6b773016a9a8910a | |
parent | f65b138ca94326bbffe06ddc28e65606a249e58e (diff) |
[PATCH] ethtool: allow const ethtool_ops
The ethtool_ops structure is immutable, it expected to be setup
by the driver and is never changed. This patch allows drivers to
declare there ethtool_ops structure read-only.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | net/core/ethtool.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 50a4719512ed..a2e747353367 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -342,7 +342,7 @@ struct net_device | |||
342 | /* Instance data managed by the core of Wireless Extensions. */ | 342 | /* Instance data managed by the core of Wireless Extensions. */ |
343 | struct iw_public_data * wireless_data; | 343 | struct iw_public_data * wireless_data; |
344 | 344 | ||
345 | struct ethtool_ops *ethtool_ops; | 345 | const struct ethtool_ops *ethtool_ops; |
346 | 346 | ||
347 | /* | 347 | /* |
348 | * This marks the end of the "visible" part of the structure. All | 348 | * This marks the end of the "visible" part of the structure. All |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 2797e2815418..e0ca04f38cef 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -143,7 +143,7 @@ static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) | |||
143 | static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) | 143 | static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) |
144 | { | 144 | { |
145 | struct ethtool_drvinfo info; | 145 | struct ethtool_drvinfo info; |
146 | struct ethtool_ops *ops = dev->ethtool_ops; | 146 | const struct ethtool_ops *ops = dev->ethtool_ops; |
147 | 147 | ||
148 | if (!ops->get_drvinfo) | 148 | if (!ops->get_drvinfo) |
149 | return -EOPNOTSUPP; | 149 | return -EOPNOTSUPP; |
@@ -169,7 +169,7 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) | |||
169 | static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) | 169 | static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) |
170 | { | 170 | { |
171 | struct ethtool_regs regs; | 171 | struct ethtool_regs regs; |
172 | struct ethtool_ops *ops = dev->ethtool_ops; | 172 | const struct ethtool_ops *ops = dev->ethtool_ops; |
173 | void *regbuf; | 173 | void *regbuf; |
174 | int reglen, ret; | 174 | int reglen, ret; |
175 | 175 | ||
@@ -282,7 +282,7 @@ static int ethtool_get_link(struct net_device *dev, void __user *useraddr) | |||
282 | static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) | 282 | static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) |
283 | { | 283 | { |
284 | struct ethtool_eeprom eeprom; | 284 | struct ethtool_eeprom eeprom; |
285 | struct ethtool_ops *ops = dev->ethtool_ops; | 285 | const struct ethtool_ops *ops = dev->ethtool_ops; |
286 | u8 *data; | 286 | u8 *data; |
287 | int ret; | 287 | int ret; |
288 | 288 | ||
@@ -327,7 +327,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) | |||
327 | static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) | 327 | static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) |
328 | { | 328 | { |
329 | struct ethtool_eeprom eeprom; | 329 | struct ethtool_eeprom eeprom; |
330 | struct ethtool_ops *ops = dev->ethtool_ops; | 330 | const struct ethtool_ops *ops = dev->ethtool_ops; |
331 | u8 *data; | 331 | u8 *data; |
332 | int ret; | 332 | int ret; |
333 | 333 | ||
@@ -640,7 +640,7 @@ static int ethtool_set_gso(struct net_device *dev, char __user *useraddr) | |||
640 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) | 640 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) |
641 | { | 641 | { |
642 | struct ethtool_test test; | 642 | struct ethtool_test test; |
643 | struct ethtool_ops *ops = dev->ethtool_ops; | 643 | const struct ethtool_ops *ops = dev->ethtool_ops; |
644 | u64 *data; | 644 | u64 *data; |
645 | int ret; | 645 | int ret; |
646 | 646 | ||
@@ -673,7 +673,7 @@ static int ethtool_self_test(struct net_device *dev, char __user *useraddr) | |||
673 | static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) | 673 | static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) |
674 | { | 674 | { |
675 | struct ethtool_gstrings gstrings; | 675 | struct ethtool_gstrings gstrings; |
676 | struct ethtool_ops *ops = dev->ethtool_ops; | 676 | const struct ethtool_ops *ops = dev->ethtool_ops; |
677 | u8 *data; | 677 | u8 *data; |
678 | int ret; | 678 | int ret; |
679 | 679 | ||
@@ -733,7 +733,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) | |||
733 | static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) | 733 | static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) |
734 | { | 734 | { |
735 | struct ethtool_stats stats; | 735 | struct ethtool_stats stats; |
736 | struct ethtool_ops *ops = dev->ethtool_ops; | 736 | const struct ethtool_ops *ops = dev->ethtool_ops; |
737 | u64 *data; | 737 | u64 *data; |
738 | int ret; | 738 | int ret; |
739 | 739 | ||