Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: microchip: rename some functions with ksz9477 prefix

Rename some functions with ksz9477 prefix to separate chip specific code
from common code.

Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
Reviewed-by: Woojung Huh <Woojung.Huh@microchip.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tristram Ha and committed by
David S. Miller
35359278 9bc981c3

+59 -57
+59 -57
drivers/net/dsa/microchip/ksz_common.c
··· 253 253 return 0; 254 254 } 255 255 256 - static int ksz_reset_switch(struct dsa_switch *ds) 256 + static int ksz9477_reset_switch(struct ksz_device *dev) 257 257 { 258 - struct ksz_device *dev = ds->priv; 259 258 u8 data8; 260 259 u16 data16; 261 260 u32 data32; ··· 287 288 return 0; 288 289 } 289 290 290 - static void port_setup(struct ksz_device *dev, int port, bool cpu_port) 291 + static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) 291 292 { 292 293 u8 data8; 293 294 u16 data16; ··· 333 334 ksz_pread16(dev, port, REG_PORT_PHY_INT_ENABLE, &data16); 334 335 } 335 336 336 - static void ksz_config_cpu_port(struct dsa_switch *ds) 337 + static void ksz9477_config_cpu_port(struct dsa_switch *ds) 337 338 { 338 339 struct ksz_device *dev = ds->priv; 339 340 int i; ··· 345 346 dev->cpu_port = i; 346 347 347 348 /* enable cpu port */ 348 - port_setup(dev, i, true); 349 + ksz9477_port_setup(dev, i, true); 349 350 } 350 351 } 351 352 } 352 353 353 - static int ksz_setup(struct dsa_switch *ds) 354 + static int ksz9477_setup(struct dsa_switch *ds) 354 355 { 355 356 struct ksz_device *dev = ds->priv; 356 357 int ret = 0; ··· 360 361 if (!dev->vlan_cache) 361 362 return -ENOMEM; 362 363 363 - ret = ksz_reset_switch(ds); 364 + ret = ksz9477_reset_switch(dev); 364 365 if (ret) { 365 366 dev_err(ds->dev, "failed to reset switch\n"); 366 367 return ret; ··· 369 370 /* accept packet up to 2000bytes */ 370 371 ksz_cfg(dev, REG_SW_MAC_CTRL_1, SW_LEGAL_PACKET_DISABLE, true); 371 372 372 - ksz_config_cpu_port(ds); 373 + ksz9477_config_cpu_port(ds); 373 374 374 375 ksz_cfg(dev, REG_SW_MAC_CTRL_1, MULTICAST_STORM_DISABLE, true); 375 376 ··· 382 383 return 0; 383 384 } 384 385 385 - static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds, 386 - int port) 386 + static enum dsa_tag_protocol ksz9477_get_tag_protocol(struct dsa_switch *ds, 387 + int port) 387 388 { 388 389 return DSA_TAG_PROTO_KSZ; 389 390 } 390 391 391 - static int ksz_phy_read16(struct dsa_switch *ds, int addr, int reg) 392 + static int ksz9477_phy_read16(struct dsa_switch *ds, int addr, int reg) 392 393 { 393 394 struct ksz_device *dev = ds->priv; 394 395 u16 val = 0; ··· 398 399 return val; 399 400 } 400 401 401 - static int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val) 402 + static int ksz9477_phy_write16(struct dsa_switch *ds, int addr, int reg, 403 + u16 val) 402 404 { 403 405 struct ksz_device *dev = ds->priv; 404 406 ··· 414 414 struct ksz_device *dev = ds->priv; 415 415 416 416 /* setup slave port */ 417 - port_setup(dev, port, false); 417 + ksz9477_port_setup(dev, port, false); 418 418 419 419 return 0; 420 420 } ··· 436 436 return TOTAL_SWITCH_COUNTER_NUM; 437 437 } 438 438 439 - static void ksz_get_strings(struct dsa_switch *ds, int port, 440 - u32 stringset, uint8_t *buf) 439 + static void ksz9477_get_strings(struct dsa_switch *ds, int port, 440 + u32 stringset, uint8_t *buf) 441 441 { 442 442 int i; 443 443 ··· 490 490 mutex_unlock(&dev->stats_mutex); 491 491 } 492 492 493 - static void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state) 493 + static void ksz9477_port_stp_state_set(struct dsa_switch *ds, int port, 494 + u8 state) 494 495 { 495 496 struct ksz_device *dev = ds->priv; 496 497 u8 data; ··· 536 535 ksz_write8(dev, REG_SW_LUE_CTRL_1, data8); 537 536 } 538 537 539 - static int ksz_port_vlan_filtering(struct dsa_switch *ds, int port, bool flag) 538 + static int ksz9477_port_vlan_filtering(struct dsa_switch *ds, int port, 539 + bool flag) 540 540 { 541 541 struct ksz_device *dev = ds->priv; 542 542 ··· 564 562 return 0; 565 563 } 566 564 567 - static void ksz_port_vlan_add(struct dsa_switch *ds, int port, 568 - const struct switchdev_obj_port_vlan *vlan) 565 + static void ksz9477_port_vlan_add(struct dsa_switch *ds, int port, 566 + const struct switchdev_obj_port_vlan *vlan) 569 567 { 570 568 struct ksz_device *dev = ds->priv; 571 569 u32 vlan_table[3]; ··· 598 596 } 599 597 } 600 598 601 - static int ksz_port_vlan_del(struct dsa_switch *ds, int port, 602 - const struct switchdev_obj_port_vlan *vlan) 599 + static int ksz9477_port_vlan_del(struct dsa_switch *ds, int port, 600 + const struct switchdev_obj_port_vlan *vlan) 603 601 { 604 602 struct ksz_device *dev = ds->priv; 605 603 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; ··· 654 652 u8 mac[ETH_ALEN]; 655 653 }; 656 654 657 - static int ksz_port_fdb_add(struct dsa_switch *ds, int port, 658 - const unsigned char *addr, u16 vid) 655 + static int ksz9477_port_fdb_add(struct dsa_switch *ds, int port, 656 + const unsigned char *addr, u16 vid) 659 657 { 660 658 struct ksz_device *dev = ds->priv; 661 659 u32 alu_table[4]; ··· 711 709 return ret; 712 710 } 713 711 714 - static int ksz_port_fdb_del(struct dsa_switch *ds, int port, 715 - const unsigned char *addr, u16 vid) 712 + static int ksz9477_port_fdb_del(struct dsa_switch *ds, int port, 713 + const unsigned char *addr, u16 vid) 716 714 { 717 715 struct ksz_device *dev = ds->priv; 718 716 u32 alu_table[4]; ··· 801 799 alu->mac[5] = alu_table[3] & 0xFF; 802 800 } 803 801 804 - static int ksz_port_fdb_dump(struct dsa_switch *ds, int port, 805 - dsa_fdb_dump_cb_t *cb, void *data) 802 + static int ksz9477_port_fdb_dump(struct dsa_switch *ds, int port, 803 + dsa_fdb_dump_cb_t *cb, void *data) 806 804 { 807 805 struct ksz_device *dev = ds->priv; 808 806 int ret = 0; ··· 860 858 return 0; 861 859 } 862 860 863 - static void ksz_port_mdb_add(struct dsa_switch *ds, int port, 864 - const struct switchdev_obj_port_mdb *mdb) 861 + static void ksz9477_port_mdb_add(struct dsa_switch *ds, int port, 862 + const struct switchdev_obj_port_mdb *mdb) 865 863 { 866 864 struct ksz_device *dev = ds->priv; 867 865 u32 static_table[4]; ··· 930 928 mutex_unlock(&dev->alu_mutex); 931 929 } 932 930 933 - static int ksz_port_mdb_del(struct dsa_switch *ds, int port, 934 - const struct switchdev_obj_port_mdb *mdb) 931 + static int ksz9477_port_mdb_del(struct dsa_switch *ds, int port, 932 + const struct switchdev_obj_port_mdb *mdb) 935 933 { 936 934 struct ksz_device *dev = ds->priv; 937 935 u32 static_table[4]; ··· 1007 1005 return ret; 1008 1006 } 1009 1007 1010 - static int ksz_port_mirror_add(struct dsa_switch *ds, int port, 1011 - struct dsa_mall_mirror_tc_entry *mirror, 1012 - bool ingress) 1008 + static int ksz9477_port_mirror_add(struct dsa_switch *ds, int port, 1009 + struct dsa_mall_mirror_tc_entry *mirror, 1010 + bool ingress) 1013 1011 { 1014 1012 struct ksz_device *dev = ds->priv; 1015 1013 ··· 1029 1027 return 0; 1030 1028 } 1031 1029 1032 - static void ksz_port_mirror_del(struct dsa_switch *ds, int port, 1033 - struct dsa_mall_mirror_tc_entry *mirror) 1030 + static void ksz9477_port_mirror_del(struct dsa_switch *ds, int port, 1031 + struct dsa_mall_mirror_tc_entry *mirror) 1034 1032 { 1035 1033 struct ksz_device *dev = ds->priv; 1036 1034 u8 data; ··· 1048 1046 } 1049 1047 1050 1048 static const struct dsa_switch_ops ksz_switch_ops = { 1051 - .get_tag_protocol = ksz_get_tag_protocol, 1052 - .setup = ksz_setup, 1053 - .phy_read = ksz_phy_read16, 1054 - .phy_write = ksz_phy_write16, 1049 + .get_tag_protocol = ksz9477_get_tag_protocol, 1050 + .setup = ksz9477_setup, 1051 + .phy_read = ksz9477_phy_read16, 1052 + .phy_write = ksz9477_phy_write16, 1055 1053 .port_enable = ksz_enable_port, 1056 1054 .port_disable = ksz_disable_port, 1057 - .get_strings = ksz_get_strings, 1055 + .get_strings = ksz9477_get_strings, 1058 1056 .get_ethtool_stats = ksz_get_ethtool_stats, 1059 1057 .get_sset_count = ksz_sset_count, 1060 - .port_stp_state_set = ksz_port_stp_state_set, 1058 + .port_stp_state_set = ksz9477_port_stp_state_set, 1061 1059 .port_fast_age = ksz_port_fast_age, 1062 - .port_vlan_filtering = ksz_port_vlan_filtering, 1060 + .port_vlan_filtering = ksz9477_port_vlan_filtering, 1063 1061 .port_vlan_prepare = ksz_port_vlan_prepare, 1064 - .port_vlan_add = ksz_port_vlan_add, 1065 - .port_vlan_del = ksz_port_vlan_del, 1066 - .port_fdb_dump = ksz_port_fdb_dump, 1067 - .port_fdb_add = ksz_port_fdb_add, 1068 - .port_fdb_del = ksz_port_fdb_del, 1062 + .port_vlan_add = ksz9477_port_vlan_add, 1063 + .port_vlan_del = ksz9477_port_vlan_del, 1064 + .port_fdb_dump = ksz9477_port_fdb_dump, 1065 + .port_fdb_add = ksz9477_port_fdb_add, 1066 + .port_fdb_del = ksz9477_port_fdb_del, 1069 1067 .port_mdb_prepare = ksz_port_mdb_prepare, 1070 - .port_mdb_add = ksz_port_mdb_add, 1071 - .port_mdb_del = ksz_port_mdb_del, 1072 - .port_mirror_add = ksz_port_mirror_add, 1073 - .port_mirror_del = ksz_port_mirror_del, 1068 + .port_mdb_add = ksz9477_port_mdb_add, 1069 + .port_mdb_del = ksz9477_port_mdb_del, 1070 + .port_mirror_add = ksz9477_port_mirror_add, 1071 + .port_mirror_del = ksz9477_port_mirror_del, 1074 1072 }; 1075 1073 1076 1074 struct ksz_chip_data { ··· 1083 1081 int port_cnt; 1084 1082 }; 1085 1083 1086 - static const struct ksz_chip_data ksz_switch_chips[] = { 1084 + static const struct ksz_chip_data ksz9477_switch_chips[] = { 1087 1085 { 1088 1086 .chip_id = 0x00947700, 1089 1087 .dev_name = "KSZ9477", ··· 1104 1102 }, 1105 1103 }; 1106 1104 1107 - static int ksz_switch_init(struct ksz_device *dev) 1105 + static int ksz9477_switch_init(struct ksz_device *dev) 1108 1106 { 1109 1107 int i; 1110 1108 1111 1109 dev->ds->ops = &ksz_switch_ops; 1112 1110 1113 - for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) { 1114 - const struct ksz_chip_data *chip = &ksz_switch_chips[i]; 1111 + for (i = 0; i < ARRAY_SIZE(ksz9477_switch_chips); i++) { 1112 + const struct ksz_chip_data *chip = &ksz9477_switch_chips[i]; 1115 1113 1116 1114 if (dev->chip_id == chip->chip_id) { 1117 1115 dev->name = chip->dev_name; ··· 1200 1198 if (ksz_switch_detect(dev)) 1201 1199 return -EINVAL; 1202 1200 1203 - ret = ksz_switch_init(dev); 1201 + ret = ksz9477_switch_init(dev); 1204 1202 if (ret) 1205 1203 return ret; 1206 1204