Commit 535ee8cd authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jason Gunthorpe

IB/hfi1: Remove unnecessary fall-through markings

Reorganize the code a bit in a more standard way[1] and remove
unnecessary fall-through markings.

[1] https://lore.kernel.org/lkml/20200708054703.GR207186@unreal/

Link: https://lore.kernel.org/r/20200709235250.GA26678@embeddedorSigned-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent acca72e2
...@@ -7317,11 +7317,11 @@ static u16 link_width_to_bits(struct hfi1_devdata *dd, u16 width) ...@@ -7317,11 +7317,11 @@ static u16 link_width_to_bits(struct hfi1_devdata *dd, u16 width)
case 1: return OPA_LINK_WIDTH_1X; case 1: return OPA_LINK_WIDTH_1X;
case 2: return OPA_LINK_WIDTH_2X; case 2: return OPA_LINK_WIDTH_2X;
case 3: return OPA_LINK_WIDTH_3X; case 3: return OPA_LINK_WIDTH_3X;
case 4: return OPA_LINK_WIDTH_4X;
default: default:
dd_dev_info(dd, "%s: invalid width %d, using 4\n", dd_dev_info(dd, "%s: invalid width %d, using 4\n",
__func__, width); __func__, width);
/* fall through */ return OPA_LINK_WIDTH_4X;
case 4: return OPA_LINK_WIDTH_4X;
} }
} }
...@@ -7376,12 +7376,13 @@ static void get_link_widths(struct hfi1_devdata *dd, u16 *tx_width, ...@@ -7376,12 +7376,13 @@ static void get_link_widths(struct hfi1_devdata *dd, u16 *tx_width,
case 0: case 0:
dd->pport[0].link_speed_active = OPA_LINK_SPEED_12_5G; dd->pport[0].link_speed_active = OPA_LINK_SPEED_12_5G;
break; break;
case 1:
dd->pport[0].link_speed_active = OPA_LINK_SPEED_25G;
break;
default: default:
dd_dev_err(dd, dd_dev_err(dd,
"%s: unexpected max rate %d, using 25Gb\n", "%s: unexpected max rate %d, using 25Gb\n",
__func__, (int)max_rate); __func__, (int)max_rate);
/* fall through */
case 1:
dd->pport[0].link_speed_active = OPA_LINK_SPEED_25G; dd->pport[0].link_speed_active = OPA_LINK_SPEED_25G;
break; break;
} }
...@@ -12878,11 +12879,6 @@ static int init_cntrs(struct hfi1_devdata *dd) ...@@ -12878,11 +12879,6 @@ static int init_cntrs(struct hfi1_devdata *dd)
static u32 chip_to_opa_lstate(struct hfi1_devdata *dd, u32 chip_lstate) static u32 chip_to_opa_lstate(struct hfi1_devdata *dd, u32 chip_lstate)
{ {
switch (chip_lstate) { switch (chip_lstate) {
default:
dd_dev_err(dd,
"Unknown logical state 0x%x, reporting IB_PORT_DOWN\n",
chip_lstate);
/* fall through */
case LSTATE_DOWN: case LSTATE_DOWN:
return IB_PORT_DOWN; return IB_PORT_DOWN;
case LSTATE_INIT: case LSTATE_INIT:
...@@ -12891,6 +12887,11 @@ static u32 chip_to_opa_lstate(struct hfi1_devdata *dd, u32 chip_lstate) ...@@ -12891,6 +12887,11 @@ static u32 chip_to_opa_lstate(struct hfi1_devdata *dd, u32 chip_lstate)
return IB_PORT_ARMED; return IB_PORT_ARMED;
case LSTATE_ACTIVE: case LSTATE_ACTIVE:
return IB_PORT_ACTIVE; return IB_PORT_ACTIVE;
default:
dd_dev_err(dd,
"Unknown logical state 0x%x, reporting IB_PORT_DOWN\n",
chip_lstate);
return IB_PORT_DOWN;
} }
} }
...@@ -12898,10 +12899,6 @@ u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate) ...@@ -12898,10 +12899,6 @@ u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate)
{ {
/* look at the HFI meta-states only */ /* look at the HFI meta-states only */
switch (chip_pstate & 0xf0) { switch (chip_pstate & 0xf0) {
default:
dd_dev_err(dd, "Unexpected chip physical state of 0x%x\n",
chip_pstate);
/* fall through */
case PLS_DISABLED: case PLS_DISABLED:
return IB_PORTPHYSSTATE_DISABLED; return IB_PORTPHYSSTATE_DISABLED;
case PLS_OFFLINE: case PLS_OFFLINE:
...@@ -12914,6 +12911,10 @@ u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate) ...@@ -12914,6 +12911,10 @@ u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate)
return IB_PORTPHYSSTATE_LINKUP; return IB_PORTPHYSSTATE_LINKUP;
case PLS_PHYTEST: case PLS_PHYTEST:
return IB_PORTPHYSSTATE_PHY_TEST; return IB_PORTPHYSSTATE_PHY_TEST;
default:
dd_dev_err(dd, "Unexpected chip physical state of 0x%x\n",
chip_pstate);
return IB_PORTPHYSSTATE_DISABLED;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment