Changeset 15470


Ignore:
Timestamp:
2009-04-28T21:16:17+02:00 (9 years ago)
Author:
nbd
Message:

swconfig: add a generic switch reset call

Location:
trunk/target/linux/generic-2.6/files
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c

    r15308 r15470  
    802802} 
    803803 
    804 static int ip175c_reset(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) 
     804static int ip175c_reset(struct switch_dev *dev) 
    805805{ 
    806806        struct ip175c_state *state = dev->priv; 
     
    11261126 
    11271127static const struct switch_attr ip175c_global[] = { 
    1128         [IP175C_RESET] = { 
    1129                 .id = IP175C_RESET, 
    1130                 .type = SWITCH_TYPE_NOVAL, 
    1131                 .name  = "reset", 
    1132                 .get = NULL, 
    1133                 .description = "Resets the switch but does not clear vlan configuration", 
    1134                 .set = ip175c_reset, 
    1135         }, 
    11361128        [IP175C_ENABLE_VLAN] = { 
    11371129                .id = IP175C_ENABLE_VLAN, 
     
    12341226        dev->set_vlan_ports = ip175c_set_ports; 
    12351227        dev->apply_config = ip175c_apply; 
     1228        dev->reset_switch = ip175c_reset; 
    12361229 
    12371230        dev->priv = state; 
     
    12661259                return err; 
    12671260 
    1268         ip175c_reset(&state->dev, NULL, NULL); 
     1261        ip175c_reset(&state->dev); 
    12691262 
    12701263        state->registered = true; 
  • trunk/target/linux/generic-2.6/files/drivers/net/phy/swconfig.c

    r15307 r15470  
    134134} 
    135135 
     136static int 
     137swconfig_reset_switch(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) 
     138{ 
     139        /* don't complain if not supported by the switch driver */ 
     140        if (!dev->reset_switch) 
     141                return 0; 
     142 
     143        return dev->reset_switch(dev); 
     144} 
    136145 
    137146enum global_defaults { 
    138147        GLOBAL_APPLY, 
     148        GLOBAL_RESET, 
    139149}; 
    140150 
     
    153163                .description = "Activate changes in the hardware", 
    154164                .set = swconfig_apply_config, 
     165        }, 
     166        [GLOBAL_RESET] = { 
     167                .type = SWITCH_TYPE_NOVAL, 
     168                .name = "reset", 
     169                .description = "Reset the switch", 
     170                .set = swconfig_reset_switch, 
    155171        } 
    156172}; 
     
    191207        /* always present, can be no-op */ 
    192208        set_bit(GLOBAL_APPLY, &dev->def_global); 
     209        set_bit(GLOBAL_RESET, &dev->def_global); 
    193210} 
    194211 
  • trunk/target/linux/generic-2.6/files/include/linux/switch.h

    r15307 r15470  
    133133        int (*set_port_pvid)(struct switch_dev *dev, int port, int val); 
    134134        int (*apply_config)(struct switch_dev *dev); 
     135        int (*reset_switch)(struct switch_dev *dev); 
    135136}; 
    136137 
Note: See TracChangeset for help on using the changeset viewer.