Re: [PATCH] net: ethernet: micrel: ksz884x.c: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist 
Date: Thu,  1 Jan 2015 18:00:23 +0100

> Removes some functions that are not used anywhere:
> hw_w_phy_link_md() hw_r_phy_link_md() hw_w_phy_polarity()
> hw_r_phy_polarity() hw_w_phy_crossover() hw_r_phy_crossover()
> hw_r_phy_rem_cap() hw_w_phy_auto_neg() hw_r_phy_auto_neg()
> hw_r_phy_link_stat() sw_get_addr() port_chk_prio() port_chk_replace_vid()
> port_chk_802_1p() port_chk_diffserv() sw_chk_unk_def_port()
> sw_cfg_unk_def_port() sw_cfg_chk_unk_def_deliver() sw_cfg_unk_def_deliver()
> port_chk_in_filter() port_chk_dis_non_vid() port_cfg_in_filter()
> port_cfg_dis_non_vid() port_chk_rmv_tag() port_chk_ins_tag()
> port_cfg_rmv_tag() port_cfg_ins_tag() sw_flush_dyn_mac_table() port_cfg_tx()
> port_cfg_rx() port_chk_force_flow_ctrl() port_chk_back_pressure()
> port_cfg_force_flow_ctrl() port_chk_broad_storm() hw_ena_intr_bit()
> 
> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 

This causes a cascade of new warnings because now functions like
phy_chk() are unused in some configurations.

I'm really not thrilled to even review change from you of this nature
if you aren't going to be careful about attending to details like
that.

Just blindly removing functions and not looking at the context or
other potential side effects is not really acceptable.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: ethernet: micrel: ksz884x.c: Remove some unused functions

2015-01-02 Thread David Miller
From: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
Date: Thu,  1 Jan 2015 18:00:23 +0100

 Removes some functions that are not used anywhere:
 hw_w_phy_link_md() hw_r_phy_link_md() hw_w_phy_polarity()
 hw_r_phy_polarity() hw_w_phy_crossover() hw_r_phy_crossover()
 hw_r_phy_rem_cap() hw_w_phy_auto_neg() hw_r_phy_auto_neg()
 hw_r_phy_link_stat() sw_get_addr() port_chk_prio() port_chk_replace_vid()
 port_chk_802_1p() port_chk_diffserv() sw_chk_unk_def_port()
 sw_cfg_unk_def_port() sw_cfg_chk_unk_def_deliver() sw_cfg_unk_def_deliver()
 port_chk_in_filter() port_chk_dis_non_vid() port_cfg_in_filter()
 port_cfg_dis_non_vid() port_chk_rmv_tag() port_chk_ins_tag()
 port_cfg_rmv_tag() port_cfg_ins_tag() sw_flush_dyn_mac_table() port_cfg_tx()
 port_cfg_rx() port_chk_force_flow_ctrl() port_chk_back_pressure()
 port_cfg_force_flow_ctrl() port_chk_broad_storm() hw_ena_intr_bit()
 
 This was partially found by using a static code analysis program called 
 cppcheck.
 
 Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

This causes a cascade of new warnings because now functions like
phy_chk() are unused in some configurations.

I'm really not thrilled to even review change from you of this nature
if you aren't going to be careful about attending to details like
that.

Just blindly removing functions and not looking at the context or
other potential side effects is not really acceptable.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: ethernet: micrel: ksz884x.c: Remove some unused functions

2015-01-01 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
hw_w_phy_link_md() hw_r_phy_link_md() hw_w_phy_polarity()
hw_r_phy_polarity() hw_w_phy_crossover() hw_r_phy_crossover()
hw_r_phy_rem_cap() hw_w_phy_auto_neg() hw_r_phy_auto_neg()
hw_r_phy_link_stat() sw_get_addr() port_chk_prio() port_chk_replace_vid()
port_chk_802_1p() port_chk_diffserv() sw_chk_unk_def_port()
sw_cfg_unk_def_port() sw_cfg_chk_unk_def_deliver() sw_cfg_unk_def_deliver()
port_chk_in_filter() port_chk_dis_non_vid() port_cfg_in_filter()
port_cfg_dis_non_vid() port_chk_rmv_tag() port_chk_ins_tag()
port_cfg_rmv_tag() port_cfg_ins_tag() sw_flush_dyn_mac_table() port_cfg_tx()
port_cfg_rx() port_chk_force_flow_ctrl() port_chk_back_pressure()
port_cfg_force_flow_ctrl() port_chk_broad_storm() hw_ena_intr_bit()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/net/ethernet/micrel/ksz884x.c |  217 -
 1 file changed, 217 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c 
b/drivers/net/ethernet/micrel/ksz884x.c
index f1ebed6c..582973f 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -1551,15 +1551,6 @@ static void hw_turn_on_intr(struct ksz_hw *hw, u32 bit)
hw_set_intr(hw, hw->intr_mask);
 }
 
-static inline void hw_ena_intr_bit(struct ksz_hw *hw, uint interrupt)
-{
-   u32 read_intr;
-
-   read_intr = readl(hw->io + KS884X_INTERRUPTS_ENABLE);
-   hw->intr_set = read_intr | interrupt;
-   writel(hw->intr_set, hw->io + KS884X_INTERRUPTS_ENABLE);
-}
-
 static inline void hw_read_intr(struct ksz_hw *hw, uint *status)
 {
*status = readl(hw->io + KS884X_INTERRUPTS_STATUS);
@@ -2125,12 +2116,6 @@ static inline void port_cfg_broad_storm(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_1_OFFSET, PORT_BROADCAST_STORM, set);
 }
 
-static inline int port_chk_broad_storm(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_BROADCAST_STORM);
-}
-
 /* Driver set switch broadcast storm protection at 10% rate. */
 #define BROADCAST_STORM_PROTECTION_RATE10
 
@@ -2283,24 +2268,6 @@ static inline void port_cfg_back_pressure(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_2_OFFSET, PORT_BACK_PRESSURE, set);
 }
 
-static inline void port_cfg_force_flow_ctrl(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_FORCE_FLOW_CTRL, set);
-}
-
-static inline int port_chk_back_pressure(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_BACK_PRESSURE);
-}
-
-static inline int port_chk_force_flow_ctrl(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_FORCE_FLOW_CTRL);
-}
-
 /* Spanning Tree */
 
 static inline void port_cfg_dis_learn(struct ksz_hw *hw, int p, int set)
@@ -2309,82 +2276,11 @@ static inline void port_cfg_dis_learn(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_2_OFFSET, PORT_LEARN_DISABLE, set);
 }
 
-static inline void port_cfg_rx(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_RX_ENABLE, set);
-}
-
-static inline void port_cfg_tx(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_TX_ENABLE, set);
-}
-
 static inline void sw_cfg_fast_aging(struct ksz_hw *hw, int set)
 {
sw_cfg(hw, KS8842_SWITCH_CTRL_1_OFFSET, SWITCH_FAST_AGING, set);
 }
 
-static inline void sw_flush_dyn_mac_table(struct ksz_hw *hw)
-{
-   if (!(hw->overrides & FAST_AGING)) {
-   sw_cfg_fast_aging(hw, 1);
-   mdelay(1);
-   sw_cfg_fast_aging(hw, 0);
-   }
-}
-
-/* VLAN */
-
-static inline void port_cfg_ins_tag(struct ksz_hw *hw, int p, int insert)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_INSERT_TAG, insert);
-}
-
-static inline void port_cfg_rmv_tag(struct ksz_hw *hw, int p, int remove)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_REMOVE_TAG, remove);
-}
-
-static inline int port_chk_ins_tag(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_INSERT_TAG);
-}
-
-static inline int port_chk_rmv_tag(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_REMOVE_TAG);
-}
-
-static inline void port_cfg_dis_non_vid(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_DISCARD_NON_VID, set);
-}
-
-static inline void port_cfg_in_filter(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_INGRESS_VLAN_FILTER, set);
-}
-
-static inline int 

[PATCH] net: ethernet: micrel: ksz884x.c: Remove some unused functions

2015-01-01 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
hw_w_phy_link_md() hw_r_phy_link_md() hw_w_phy_polarity()
hw_r_phy_polarity() hw_w_phy_crossover() hw_r_phy_crossover()
hw_r_phy_rem_cap() hw_w_phy_auto_neg() hw_r_phy_auto_neg()
hw_r_phy_link_stat() sw_get_addr() port_chk_prio() port_chk_replace_vid()
port_chk_802_1p() port_chk_diffserv() sw_chk_unk_def_port()
sw_cfg_unk_def_port() sw_cfg_chk_unk_def_deliver() sw_cfg_unk_def_deliver()
port_chk_in_filter() port_chk_dis_non_vid() port_cfg_in_filter()
port_cfg_dis_non_vid() port_chk_rmv_tag() port_chk_ins_tag()
port_cfg_rmv_tag() port_cfg_ins_tag() sw_flush_dyn_mac_table() port_cfg_tx()
port_cfg_rx() port_chk_force_flow_ctrl() port_chk_back_pressure()
port_cfg_force_flow_ctrl() port_chk_broad_storm() hw_ena_intr_bit()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
---
 drivers/net/ethernet/micrel/ksz884x.c |  217 -
 1 file changed, 217 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c 
b/drivers/net/ethernet/micrel/ksz884x.c
index f1ebed6c..582973f 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -1551,15 +1551,6 @@ static void hw_turn_on_intr(struct ksz_hw *hw, u32 bit)
hw_set_intr(hw, hw-intr_mask);
 }
 
-static inline void hw_ena_intr_bit(struct ksz_hw *hw, uint interrupt)
-{
-   u32 read_intr;
-
-   read_intr = readl(hw-io + KS884X_INTERRUPTS_ENABLE);
-   hw-intr_set = read_intr | interrupt;
-   writel(hw-intr_set, hw-io + KS884X_INTERRUPTS_ENABLE);
-}
-
 static inline void hw_read_intr(struct ksz_hw *hw, uint *status)
 {
*status = readl(hw-io + KS884X_INTERRUPTS_STATUS);
@@ -2125,12 +2116,6 @@ static inline void port_cfg_broad_storm(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_1_OFFSET, PORT_BROADCAST_STORM, set);
 }
 
-static inline int port_chk_broad_storm(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_BROADCAST_STORM);
-}
-
 /* Driver set switch broadcast storm protection at 10% rate. */
 #define BROADCAST_STORM_PROTECTION_RATE10
 
@@ -2283,24 +2268,6 @@ static inline void port_cfg_back_pressure(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_2_OFFSET, PORT_BACK_PRESSURE, set);
 }
 
-static inline void port_cfg_force_flow_ctrl(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_FORCE_FLOW_CTRL, set);
-}
-
-static inline int port_chk_back_pressure(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_BACK_PRESSURE);
-}
-
-static inline int port_chk_force_flow_ctrl(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_FORCE_FLOW_CTRL);
-}
-
 /* Spanning Tree */
 
 static inline void port_cfg_dis_learn(struct ksz_hw *hw, int p, int set)
@@ -2309,82 +2276,11 @@ static inline void port_cfg_dis_learn(struct ksz_hw 
*hw, int p, int set)
KS8842_PORT_CTRL_2_OFFSET, PORT_LEARN_DISABLE, set);
 }
 
-static inline void port_cfg_rx(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_RX_ENABLE, set);
-}
-
-static inline void port_cfg_tx(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_TX_ENABLE, set);
-}
-
 static inline void sw_cfg_fast_aging(struct ksz_hw *hw, int set)
 {
sw_cfg(hw, KS8842_SWITCH_CTRL_1_OFFSET, SWITCH_FAST_AGING, set);
 }
 
-static inline void sw_flush_dyn_mac_table(struct ksz_hw *hw)
-{
-   if (!(hw-overrides  FAST_AGING)) {
-   sw_cfg_fast_aging(hw, 1);
-   mdelay(1);
-   sw_cfg_fast_aging(hw, 0);
-   }
-}
-
-/* VLAN */
-
-static inline void port_cfg_ins_tag(struct ksz_hw *hw, int p, int insert)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_INSERT_TAG, insert);
-}
-
-static inline void port_cfg_rmv_tag(struct ksz_hw *hw, int p, int remove)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_REMOVE_TAG, remove);
-}
-
-static inline int port_chk_ins_tag(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_INSERT_TAG);
-}
-
-static inline int port_chk_rmv_tag(struct ksz_hw *hw, int p)
-{
-   return port_chk(hw, p,
-   KS8842_PORT_CTRL_1_OFFSET, PORT_REMOVE_TAG);
-}
-
-static inline void port_cfg_dis_non_vid(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_DISCARD_NON_VID, set);
-}
-
-static inline void port_cfg_in_filter(struct ksz_hw *hw, int p, int set)
-{
-   port_cfg(hw, p,
-   KS8842_PORT_CTRL_2_OFFSET, PORT_INGRESS_VLAN_FILTER, set);
-}
-