diff --git a/ethernet.c b/ethernet.c
index a69748c6b30bad87c14bd84e437c335cd951e262..451aa92db3edc426f4ff1b73be25f6a7697a7397 100644
--- a/ethernet.c
+++ b/ethernet.c
@@ -38,11 +38,11 @@
 
 #include "ethernet.h"
 
-#ifdef IOPSYS_BROADCOM
+#if defined(IOPSYS_BROADCOM)
 extern const struct eth_ops bcm_eth_ops;
-#elif IOPSYS_TEST
+#elif defined(IOPSYS_TEST)
 extern const struct eth_ops test_eth_ops;
-#elif IOPSYS_ECONET
+#elif defined(IOPSYS_ECONET)
 extern const struct eth_ops econet_gen_eth_ops;
 extern const struct eth_ops econet_nas_wan_eth_ops;
 extern const struct eth_ops econet_ae_wan_eth_ops;
@@ -51,11 +51,11 @@ extern const struct eth_ops ethsw_ops;
 #endif
 
 const struct eth_ops *eth_ops[] = {
-#ifdef IOPSYS_BROADCOM
+#if defined(IOPSYS_BROADCOM)
 	&bcm_eth_ops,
-#elif IOPSYS_TEST
+#elif defined(IOPSYS_TEST)
 	&test_eth_ops,
-#elif IOPSYS_ECONET
+#elif defined(IOPSYS_ECONET)
 	&econet_gen_eth_ops,
 	&econet_nas_wan_eth_ops,
 	&econet_ae_wan_eth_ops,
@@ -244,7 +244,7 @@ int eth_mii_get_phy_id(const char *ifname, int port, int *phy_id)
 
 	mii = if_mii(&ifr);
 	memset(mii, 0, sizeof(struct mii_ioctl_data));
-	mii->val_in = port;
+	mii->val_in = (uint16_t)port;
 
 	if (ioctl(s, SIOCGMIIPHY, &ifr) < 0) {
 		libethernet_err("SIOCGMIIPHY failed!\n");
@@ -283,9 +283,9 @@ static int eth_mii_ioctl(const char *ifname, int cmd, int phy_id, int reg,
 	memset(mii, 0, sizeof(struct mii_ioctl_data));
 
 	//PHYID_2_MII_IOCTL(phy_id, mii);
-	mii->phy_id = phy_id;
-	mii->reg_num = reg;
-	mii->val_in = in;
+	mii->phy_id = (uint16_t)phy_id;
+	mii->reg_num = (uint16_t)reg;
+	mii->val_in = (uint16_t)in;
 
 	if (ioctl(s, cmd, &ifr) < 0) {
 		libethernet_err("MII cmd on %s failed\n", ifr.ifr_name);