diff options
author | Frank Pavlic <fpavlic@de.ibm.com> | 2006-03-22 10:03:41 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-22 20:29:30 -0500 |
commit | 1380fee2b553fbde1a094476685f43ec5625aec2 (patch) | |
tree | be0fb1266ce2706b624a157ed64de97a9c25ff67 | |
parent | 95f6b5a1e38e26dc313e283e1e6058d3ffff517d (diff) |
[PATCH] s390: qeth driver cleanups
[patch 3/6] s390: qeth driver cleanups
From: Ursula Braun <braunu@de.ibm.com>
- code analyzing tool BEAM has found some unreachable
and unnecessary statements and also conditions
which are always true.
- removed some useless MII code since OSA card will never
allow to set such values.
Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com>
diffstat:
qeth_main.c | 49 ++++---------------------------------------------
qeth_proc.c | 18 +++++++++---------
qeth_sys.c | 2 +-
3 files changed, 14 insertions(+), 55 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/s390/net/qeth_main.c | 49 | ||||
-rw-r--r-- | drivers/s390/net/qeth_proc.c | 18 | ||||
-rw-r--r-- | drivers/s390/net/qeth_sys.c | 2 |
3 files changed, 14 insertions, 55 deletions
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 634c3958f426..69329ea61e2b 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -1364,7 +1364,7 @@ qeth_wait_for_buffer(struct qeth_channel *channel) | |||
1364 | static void | 1364 | static void |
1365 | qeth_clear_cmd_buffers(struct qeth_channel *channel) | 1365 | qeth_clear_cmd_buffers(struct qeth_channel *channel) |
1366 | { | 1366 | { |
1367 | int cnt = 0; | 1367 | int cnt; |
1368 | 1368 | ||
1369 | for (cnt=0; cnt < QETH_CMD_BUFFER_NO; cnt++) | 1369 | for (cnt=0; cnt < QETH_CMD_BUFFER_NO; cnt++) |
1370 | qeth_release_buffer(channel,&channel->iob[cnt]); | 1370 | qeth_release_buffer(channel,&channel->iob[cnt]); |
@@ -2814,11 +2814,11 @@ qeth_handle_send_error(struct qeth_card *card, | |||
2814 | QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); | 2814 | QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); |
2815 | return QETH_SEND_ERROR_LINK_FAILURE; | 2815 | return QETH_SEND_ERROR_LINK_FAILURE; |
2816 | case 3: | 2816 | case 3: |
2817 | default: | ||
2817 | QETH_DBF_TEXT(trace, 1, "SIGAcc3"); | 2818 | QETH_DBF_TEXT(trace, 1, "SIGAcc3"); |
2818 | QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); | 2819 | QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); |
2819 | return QETH_SEND_ERROR_KICK_IT; | 2820 | return QETH_SEND_ERROR_KICK_IT; |
2820 | } | 2821 | } |
2821 | return QETH_SEND_ERROR_LINK_FAILURE; | ||
2822 | } | 2822 | } |
2823 | 2823 | ||
2824 | void | 2824 | void |
@@ -3865,6 +3865,7 @@ qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
3865 | if ((hdr_mac == QETH_TR_MAC_NC) || | 3865 | if ((hdr_mac == QETH_TR_MAC_NC) || |
3866 | (hdr_mac == QETH_TR_MAC_C)) | 3866 | (hdr_mac == QETH_TR_MAC_C)) |
3867 | return RTN_MULTICAST; | 3867 | return RTN_MULTICAST; |
3868 | break; | ||
3868 | /* eth or so multicast? */ | 3869 | /* eth or so multicast? */ |
3869 | default: | 3870 | default: |
3870 | if ((hdr_mac == QETH_ETH_MAC_V4) || | 3871 | if ((hdr_mac == QETH_ETH_MAC_V4) || |
@@ -4586,38 +4587,11 @@ qeth_mdio_read(struct net_device *dev, int phy_id, int regnum) | |||
4586 | case MII_NCONFIG: /* network interface config */ | 4587 | case MII_NCONFIG: /* network interface config */ |
4587 | break; | 4588 | break; |
4588 | default: | 4589 | default: |
4589 | rc = 0; | ||
4590 | break; | 4590 | break; |
4591 | } | 4591 | } |
4592 | return rc; | 4592 | return rc; |
4593 | } | 4593 | } |
4594 | 4594 | ||
4595 | static void | ||
4596 | qeth_mdio_write(struct net_device *dev, int phy_id, int regnum, int value) | ||
4597 | { | ||
4598 | switch(regnum){ | ||
4599 | case MII_BMCR: /* Basic mode control register */ | ||
4600 | case MII_BMSR: /* Basic mode status register */ | ||
4601 | case MII_PHYSID1: /* PHYS ID 1 */ | ||
4602 | case MII_PHYSID2: /* PHYS ID 2 */ | ||
4603 | case MII_ADVERTISE: /* Advertisement control reg */ | ||
4604 | case MII_LPA: /* Link partner ability reg */ | ||
4605 | case MII_EXPANSION: /* Expansion register */ | ||
4606 | case MII_DCOUNTER: /* disconnect counter */ | ||
4607 | case MII_FCSCOUNTER: /* false carrier counter */ | ||
4608 | case MII_NWAYTEST: /* N-way auto-neg test register */ | ||
4609 | case MII_RERRCOUNTER: /* rx error counter */ | ||
4610 | case MII_SREVISION: /* silicon revision */ | ||
4611 | case MII_RESV1: /* reserved 1 */ | ||
4612 | case MII_LBRERROR: /* loopback, rx, bypass error */ | ||
4613 | case MII_PHYADDR: /* physical address */ | ||
4614 | case MII_RESV2: /* reserved 2 */ | ||
4615 | case MII_TPISTATUS: /* TPI status for 10mbps */ | ||
4616 | case MII_NCONFIG: /* network interface config */ | ||
4617 | default: | ||
4618 | break; | ||
4619 | } | ||
4620 | } | ||
4621 | 4595 | ||
4622 | static inline const char * | 4596 | static inline const char * |
4623 | qeth_arp_get_error_cause(int *rc) | 4597 | qeth_arp_get_error_cause(int *rc) |
@@ -5237,21 +5211,6 @@ qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
5237 | mii_data->val_out = qeth_mdio_read(dev,mii_data->phy_id, | 5211 | mii_data->val_out = qeth_mdio_read(dev,mii_data->phy_id, |
5238 | mii_data->reg_num); | 5212 | mii_data->reg_num); |
5239 | break; | 5213 | break; |
5240 | case SIOCSMIIREG: | ||
5241 | rc = -EOPNOTSUPP; | ||
5242 | break; | ||
5243 | /* TODO: remove return if qeth_mdio_write does something */ | ||
5244 | if (!capable(CAP_NET_ADMIN)){ | ||
5245 | rc = -EPERM; | ||
5246 | break; | ||
5247 | } | ||
5248 | mii_data = if_mii(rq); | ||
5249 | if (mii_data->phy_id != 0) | ||
5250 | rc = -EINVAL; | ||
5251 | else | ||
5252 | qeth_mdio_write(dev, mii_data->phy_id, mii_data->reg_num, | ||
5253 | mii_data->val_in); | ||
5254 | break; | ||
5255 | default: | 5214 | default: |
5256 | rc = -EOPNOTSUPP; | 5215 | rc = -EOPNOTSUPP; |
5257 | } | 5216 | } |
@@ -6901,7 +6860,7 @@ qeth_send_setassparms(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
6901 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 6860 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
6902 | if (len <= sizeof(__u32)) | 6861 | if (len <= sizeof(__u32)) |
6903 | cmd->data.setassparms.data.flags_32bit = (__u32) data; | 6862 | cmd->data.setassparms.data.flags_32bit = (__u32) data; |
6904 | else if (len > sizeof(__u32)) | 6863 | else /* (len > sizeof(__u32)) */ |
6905 | memcpy(&cmd->data.setassparms.data, (void *) data, len); | 6864 | memcpy(&cmd->data.setassparms.data, (void *) data, len); |
6906 | 6865 | ||
6907 | rc = qeth_send_ipa_cmd(card, iob, reply_cb, reply_param); | 6866 | rc = qeth_send_ipa_cmd(card, iob, reply_cb, reply_param); |
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index 1304641545df..360d782c7ada 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c | |||
@@ -74,7 +74,7 @@ qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | |||
74 | static inline const char * | 74 | static inline const char * |
75 | qeth_get_router_str(struct qeth_card *card, int ipv) | 75 | qeth_get_router_str(struct qeth_card *card, int ipv) |
76 | { | 76 | { |
77 | int routing_type = 0; | 77 | enum qeth_routing_types routing_type = NO_ROUTER; |
78 | 78 | ||
79 | if (ipv == 4) { | 79 | if (ipv == 4) { |
80 | routing_type = card->options.route4.type; | 80 | routing_type = card->options.route4.type; |
@@ -86,26 +86,26 @@ qeth_get_router_str(struct qeth_card *card, int ipv) | |||
86 | #endif /* CONFIG_QETH_IPV6 */ | 86 | #endif /* CONFIG_QETH_IPV6 */ |
87 | } | 87 | } |
88 | 88 | ||
89 | if (routing_type == PRIMARY_ROUTER) | 89 | switch (routing_type){ |
90 | case PRIMARY_ROUTER: | ||
90 | return "pri"; | 91 | return "pri"; |
91 | else if (routing_type == SECONDARY_ROUTER) | 92 | case SECONDARY_ROUTER: |
92 | return "sec"; | 93 | return "sec"; |
93 | else if (routing_type == MULTICAST_ROUTER) { | 94 | case MULTICAST_ROUTER: |
94 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) | 95 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) |
95 | return "mc+"; | 96 | return "mc+"; |
96 | return "mc"; | 97 | return "mc"; |
97 | } else if (routing_type == PRIMARY_CONNECTOR) { | 98 | case PRIMARY_CONNECTOR: |
98 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) | 99 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) |
99 | return "p+c"; | 100 | return "p+c"; |
100 | return "p.c"; | 101 | return "p.c"; |
101 | } else if (routing_type == SECONDARY_CONNECTOR) { | 102 | case SECONDARY_CONNECTOR: |
102 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) | 103 | if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) |
103 | return "s+c"; | 104 | return "s+c"; |
104 | return "s.c"; | 105 | return "s.c"; |
105 | } else if (routing_type == NO_ROUTER) | 106 | default: /* NO_ROUTER */ |
106 | return "no"; | 107 | return "no"; |
107 | else | 108 | } |
108 | return "unk"; | ||
109 | } | 109 | } |
110 | 110 | ||
111 | static int | 111 | static int |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index c1831f572585..f2a076a2b2f1 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -115,7 +115,7 @@ qeth_dev_portno_store(struct device *dev, struct device_attribute *attr, const c | |||
115 | return -EPERM; | 115 | return -EPERM; |
116 | 116 | ||
117 | portno = simple_strtoul(buf, &tmp, 16); | 117 | portno = simple_strtoul(buf, &tmp, 16); |
118 | if ((portno < 0) || (portno > MAX_PORTNO)){ | 118 | if (portno > MAX_PORTNO){ |
119 | PRINT_WARN("portno 0x%X is out of range\n", portno); | 119 | PRINT_WARN("portno 0x%X is out of range\n", portno); |
120 | return -EINVAL; | 120 | return -EINVAL; |
121 | } | 121 | } |