diff options
author | Frank Pavlic <fpavlic@de.ibm.com> | 2006-03-22 16:03:41 +0100 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-22 20:29:30 -0500 |
commit | 1380fee2b553fbde1a094476685f43ec5625aec2 (patch) | |
tree | be0fb1266ce2706b624a157ed64de97a9c25ff67 | |
parent | 95f6b5a1e38e26dc313e283e1e6058d3ffff517d (diff) | |
download | blackbird-op-linux-1380fee2b553fbde1a094476685f43ec5625aec2.tar.gz blackbird-op-linux-1380fee2b553fbde1a094476685f43ec5625aec2.zip |
[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) static void qeth_clear_cmd_buffers(struct qeth_channel *channel) { - int cnt = 0; + int cnt; for (cnt=0; cnt < QETH_CMD_BUFFER_NO; cnt++) qeth_release_buffer(channel,&channel->iob[cnt]); @@ -2814,11 +2814,11 @@ qeth_handle_send_error(struct qeth_card *card, QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); return QETH_SEND_ERROR_LINK_FAILURE; case 3: + default: QETH_DBF_TEXT(trace, 1, "SIGAcc3"); QETH_DBF_TEXT_(trace,1,"%s",CARD_BUS_ID(card)); return QETH_SEND_ERROR_KICK_IT; } - return QETH_SEND_ERROR_LINK_FAILURE; } void @@ -3865,6 +3865,7 @@ qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb) if ((hdr_mac == QETH_TR_MAC_NC) || (hdr_mac == QETH_TR_MAC_C)) return RTN_MULTICAST; + break; /* eth or so multicast? */ default: if ((hdr_mac == QETH_ETH_MAC_V4) || @@ -4586,38 +4587,11 @@ qeth_mdio_read(struct net_device *dev, int phy_id, int regnum) case MII_NCONFIG: /* network interface config */ break; default: - rc = 0; break; } return rc; } -static void -qeth_mdio_write(struct net_device *dev, int phy_id, int regnum, int value) -{ - switch(regnum){ - case MII_BMCR: /* Basic mode control register */ - case MII_BMSR: /* Basic mode status register */ - case MII_PHYSID1: /* PHYS ID 1 */ - case MII_PHYSID2: /* PHYS ID 2 */ - case MII_ADVERTISE: /* Advertisement control reg */ - case MII_LPA: /* Link partner ability reg */ - case MII_EXPANSION: /* Expansion register */ - case MII_DCOUNTER: /* disconnect counter */ - case MII_FCSCOUNTER: /* false carrier counter */ - case MII_NWAYTEST: /* N-way auto-neg test register */ - case MII_RERRCOUNTER: /* rx error counter */ - case MII_SREVISION: /* silicon revision */ - case MII_RESV1: /* reserved 1 */ - case MII_LBRERROR: /* loopback, rx, bypass error */ - case MII_PHYADDR: /* physical address */ - case MII_RESV2: /* reserved 2 */ - case MII_TPISTATUS: /* TPI status for 10mbps */ - case MII_NCONFIG: /* network interface config */ - default: - break; - } -} static inline const char * qeth_arp_get_error_cause(int *rc) @@ -5237,21 +5211,6 @@ qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) mii_data->val_out = qeth_mdio_read(dev,mii_data->phy_id, mii_data->reg_num); break; - case SIOCSMIIREG: - rc = -EOPNOTSUPP; - break; - /* TODO: remove return if qeth_mdio_write does something */ - if (!capable(CAP_NET_ADMIN)){ - rc = -EPERM; - break; - } - mii_data = if_mii(rq); - if (mii_data->phy_id != 0) - rc = -EINVAL; - else - qeth_mdio_write(dev, mii_data->phy_id, mii_data->reg_num, - mii_data->val_in); - break; default: rc = -EOPNOTSUPP; } @@ -6901,7 +6860,7 @@ qeth_send_setassparms(struct qeth_card *card, struct qeth_cmd_buffer *iob, cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); if (len <= sizeof(__u32)) cmd->data.setassparms.data.flags_32bit = (__u32) data; - else if (len > sizeof(__u32)) + else /* (len > sizeof(__u32)) */ memcpy(&cmd->data.setassparms.data, (void *) data, len); 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) static inline const char * qeth_get_router_str(struct qeth_card *card, int ipv) { - int routing_type = 0; + enum qeth_routing_types routing_type = NO_ROUTER; if (ipv == 4) { routing_type = card->options.route4.type; @@ -86,26 +86,26 @@ qeth_get_router_str(struct qeth_card *card, int ipv) #endif /* CONFIG_QETH_IPV6 */ } - if (routing_type == PRIMARY_ROUTER) + switch (routing_type){ + case PRIMARY_ROUTER: return "pri"; - else if (routing_type == SECONDARY_ROUTER) + case SECONDARY_ROUTER: return "sec"; - else if (routing_type == MULTICAST_ROUTER) { + case MULTICAST_ROUTER: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "mc+"; return "mc"; - } else if (routing_type == PRIMARY_CONNECTOR) { + case PRIMARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "p+c"; return "p.c"; - } else if (routing_type == SECONDARY_CONNECTOR) { + case SECONDARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "s+c"; return "s.c"; - } else if (routing_type == NO_ROUTER) + default: /* NO_ROUTER */ return "no"; - else - return "unk"; + } } 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 return -EPERM; portno = simple_strtoul(buf, &tmp, 16); - if ((portno < 0) || (portno > MAX_PORTNO)){ + if (portno > MAX_PORTNO){ PRINT_WARN("portno 0x%X is out of range\n", portno); return -EINVAL; } |