Message ID | 20220513102219.30399-2-arun.ramadoss@microchip.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dsa: microchip: refactor the ksz switch init function | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 23 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Fri, May 13, 2022 at 03:52:11PM +0530, Arun Ramadoss wrote: > The port_cnt value in the structure is not used in the switch_init. > Instead it uses the fls(chip->cpu_port), this is due to one of port in > the ksz8794 unavailable. The cpu_port for the 8794 is 0x10, fls(0x10) = > 5, hence updating it directly in the ksz_chip_data structure in order to > same with all the other switches in ksz8795.c and ksz9477.c files. > > Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com> > --- Sounds like a straightforward transformation based on a valid observation. Reviewed-by: Vladimir Oltean <olteanv@gmail.com> > drivers/net/dsa/microchip/ksz8795.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c > index f91deea9368e..83bcabf2dc54 100644 > --- a/drivers/net/dsa/microchip/ksz8795.c > +++ b/drivers/net/dsa/microchip/ksz8795.c > @@ -1607,6 +1607,7 @@ static const struct ksz_chip_data ksz8_switch_chips[] = { > * KSZ8794 0,1,2 4 > * KSZ8795 0,1,2,3 4 > * KSZ8765 0,1,2,3 4 > + * port_cnt is configured as 5, even though it is 4 > */ > .chip_id = 0x8794, > .dev_name = "KSZ8794", > @@ -1614,7 +1615,7 @@ static const struct ksz_chip_data ksz8_switch_chips[] = { > .num_alus = 0, > .num_statics = 8, > .cpu_ports = 0x10, /* can be configured as cpu port */ > - .port_cnt = 4, /* total cpu and user ports */ > + .port_cnt = 5, /* total cpu and user ports */ > .ksz87xx_eee_link_erratum = true, > }, > { > @@ -1653,7 +1654,7 @@ static int ksz8_switch_init(struct ksz_device *dev) > dev->num_vlans = chip->num_vlans; > dev->num_alus = chip->num_alus; > dev->num_statics = chip->num_statics; > - dev->port_cnt = fls(chip->cpu_ports); > + dev->port_cnt = chip->port_cnt; > dev->cpu_port = fls(chip->cpu_ports) - 1; > dev->phy_port_cnt = dev->port_cnt - 1; > dev->cpu_ports = chip->cpu_ports; > -- > 2.33.0 >
On 5/13/2022 3:22 AM, Arun Ramadoss wrote: > The port_cnt value in the structure is not used in the switch_init. > Instead it uses the fls(chip->cpu_port), this is due to one of port in > the ksz8794 unavailable. The cpu_port for the 8794 is 0x10, fls(0x10) = > 5, hence updating it directly in the ksz_chip_data structure in order to > same with all the other switches in ksz8795.c and ksz9477.c files. > > Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index f91deea9368e..83bcabf2dc54 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1607,6 +1607,7 @@ static const struct ksz_chip_data ksz8_switch_chips[] = { * KSZ8794 0,1,2 4 * KSZ8795 0,1,2,3 4 * KSZ8765 0,1,2,3 4 + * port_cnt is configured as 5, even though it is 4 */ .chip_id = 0x8794, .dev_name = "KSZ8794", @@ -1614,7 +1615,7 @@ static const struct ksz_chip_data ksz8_switch_chips[] = { .num_alus = 0, .num_statics = 8, .cpu_ports = 0x10, /* can be configured as cpu port */ - .port_cnt = 4, /* total cpu and user ports */ + .port_cnt = 5, /* total cpu and user ports */ .ksz87xx_eee_link_erratum = true, }, { @@ -1653,7 +1654,7 @@ static int ksz8_switch_init(struct ksz_device *dev) dev->num_vlans = chip->num_vlans; dev->num_alus = chip->num_alus; dev->num_statics = chip->num_statics; - dev->port_cnt = fls(chip->cpu_ports); + dev->port_cnt = chip->port_cnt; dev->cpu_port = fls(chip->cpu_ports) - 1; dev->phy_port_cnt = dev->port_cnt - 1; dev->cpu_ports = chip->cpu_ports;
The port_cnt value in the structure is not used in the switch_init. Instead it uses the fls(chip->cpu_port), this is due to one of port in the ksz8794 unavailable. The cpu_port for the 8794 is 0x10, fls(0x10) = 5, hence updating it directly in the ksz_chip_data structure in order to same with all the other switches in ksz8795.c and ksz9477.c files. Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com> --- drivers/net/dsa/microchip/ksz8795.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)