Skip to content

Commit 285cc15

Browse files
hkallweitdavem330
authored andcommitted
ethtool: adjust struct ethtool_keee to kernel needs
This patch changes the following in struct ethtool_keee - remove member cmd, it's not needed on kernel side - remove reserved fields - switch the semantically boolean members to type bool We don't have to change any user of the boolean members due to the implicit casting from/to bool. A small change is needed where a pointer to bool members is used, in addition remove few now unneeded double negations. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0b3100b commit 285cc15

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

include/linux/ethtool.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,13 @@ __ethtool_get_link_ksettings(struct net_device *dev,
223223
struct ethtool_link_ksettings *link_ksettings);
224224

225225
struct ethtool_keee {
226-
u32 cmd;
227226
u32 supported;
228227
u32 advertised;
229228
u32 lp_advertised;
230-
u32 eee_active;
231-
u32 eee_enabled;
232-
u32 tx_lpi_enabled;
233229
u32 tx_lpi_timer;
234-
u32 reserved[2];
230+
bool tx_lpi_enabled;
231+
bool eee_active;
232+
bool eee_enabled;
235233
};
236234

237235
struct kernel_ethtool_coalesce {

net/ethtool/eee.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ static int eee_fill_reply(struct sk_buff *skb,
9898
if (ret < 0)
9999
return ret;
100100

101-
if (nla_put_u8(skb, ETHTOOL_A_EEE_ACTIVE, !!eee->eee_active) ||
102-
nla_put_u8(skb, ETHTOOL_A_EEE_ENABLED, !!eee->eee_enabled) ||
101+
if (nla_put_u8(skb, ETHTOOL_A_EEE_ACTIVE, eee->eee_active) ||
102+
nla_put_u8(skb, ETHTOOL_A_EEE_ENABLED, eee->eee_enabled) ||
103103
nla_put_u8(skb, ETHTOOL_A_EEE_TX_LPI_ENABLED,
104-
!!eee->tx_lpi_enabled) ||
104+
eee->tx_lpi_enabled) ||
105105
nla_put_u32(skb, ETHTOOL_A_EEE_TX_LPI_TIMER, eee->tx_lpi_timer))
106106
return -EMSGSIZE;
107107

@@ -145,9 +145,9 @@ ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info)
145145
link_mode_names, info->extack, &mod);
146146
if (ret < 0)
147147
return ret;
148-
ethnl_update_bool32(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod);
149-
ethnl_update_bool32(&eee.tx_lpi_enabled,
150-
tb[ETHTOOL_A_EEE_TX_LPI_ENABLED], &mod);
148+
ethnl_update_bool(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod);
149+
ethnl_update_bool(&eee.tx_lpi_enabled, tb[ETHTOOL_A_EEE_TX_LPI_ENABLED],
150+
&mod);
151151
ethnl_update_u32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER],
152152
&mod);
153153
if (!mod)

0 commit comments

Comments
 (0)