mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/3] misc: pch_phub: Fix fallout and more cleanup
@ 2026-05-26  8:52 Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 1/3] misc: pch_phub: Complete enum usage for device identification Uwe Kleine-König (The Capable Hub)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26  8:52 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

Hello,

Sashiko found a relevant issue in the patch that became 7b1d4ad96ea4
("misc: pch_phub: Introduce an enum for device indentification"). This
is fixed in the first patch.

The second patch is a follow-up to commit d14b649fd99f ("misc: pch_phub:
Drop two unused functions") that drops now unused struct members.

The third patch fixes an inconsistency in device handling. The comment
suggest that ML7213 isn't handled, the code just falls back in the else
branch for it. Make variant handling more explicit using a switch
statement. If a new device is added without adapting
pch_phub_write_gbe_mac_addr() a compiler warning is triggered.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (3):
  misc: pch_phub: Complete enum usage for device identification
  misc: pch_phub: Drop unused members from struct pch_phub_reg
  misc: pch_phub: Make MAC address configuration more robust

 drivers/misc/pch_phub.c | 59 ++++++++++++++---------------------------
 1 file changed, 20 insertions(+), 39 deletions(-)


base-commit: 7b1d4ad96ea47b3275328fa385d0497e164f1f5f
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/3] misc: pch_phub: Complete enum usage for device identification
  2026-05-26  8:52 [PATCH v1 0/3] misc: pch_phub: Fix fallout and more cleanup Uwe Kleine-König (The Capable Hub)
@ 2026-05-26  8:52 ` Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 2/3] misc: pch_phub: Drop unused members from struct pch_phub_reg Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 3/3] misc: pch_phub: Make MAC address configuration more robust Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26  8:52 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

Recently an enum was introduced to identify the different hardware
variants instead of magic constants. The respective commit however
missed to adapt one code location that still checks the old values.

As the values shifted by one this is a relevant fix.

Fixes: 7b1d4ad96ea4 ("misc: pch_phub: Introduce an enum for device indentification")
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/misc/pch_phub.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 19c4fa017f24..0097611b97af 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -83,6 +83,14 @@
 
 #define PCH_PHUB_OROM_SIZE 15360
 
+enum pch_phub_type {
+	PCH_EG20T,
+	PCH_ML7213,
+	PCH_ML7223M,
+	PCH_ML7223N,
+	PCH_ML7831,
+};
+
 /**
  * struct pch_phub_reg - PHUB register structure
  * @phub_id_reg:			PHUB_ID register val
@@ -125,7 +133,7 @@ struct pch_phub_reg {
 	void __iomem *pch_phub_extrom_base_address;
 	u32 pch_mac_start_address;
 	u32 pch_opt_rom_start_address;
-	int ioh_type;
+	enum pch_phub_type ioh_type;
 	struct pci_dev *pdev;
 };
 
@@ -344,7 +352,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
 	int retval;
 	int i;
 
-	if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/
+	if (chip->ioh_type == PCH_EG20T || chip->ioh_type == PCH_ML7831)
 		retval = pch_phub_gbe_serial_rom_conf(chip);
 	else	/* ML7223 */
 		retval = pch_phub_gbe_serial_rom_conf_mp(chip);
@@ -537,14 +545,6 @@ static const struct bin_attribute pch_bin_attr = {
 	.write = pch_phub_bin_write,
 };
 
-enum {
-	PCH_EG20T,
-	PCH_ML7213,
-	PCH_ML7223M,
-	PCH_ML7223N,
-	PCH_ML7831,
-};
-
 static int pch_phub_probe(struct pci_dev *pdev,
 				    const struct pci_device_id *id)
 {
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 2/3] misc: pch_phub: Drop unused members from struct pch_phub_reg
  2026-05-26  8:52 [PATCH v1 0/3] misc: pch_phub: Fix fallout and more cleanup Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 1/3] misc: pch_phub: Complete enum usage for device identification Uwe Kleine-König (The Capable Hub)
@ 2026-05-26  8:52 ` Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 3/3] misc: pch_phub: Make MAC address configuration more robust Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26  8:52 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

Since commit d14b649fd99f ("misc: pch_phub: Drop two unused functions")
all the register values in struct pch_phub_reg are unused. Drop them.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/misc/pch_phub.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 0097611b97af..5adf7f0c84ab 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -93,20 +93,6 @@ enum pch_phub_type {
 
 /**
  * struct pch_phub_reg - PHUB register structure
- * @phub_id_reg:			PHUB_ID register val
- * @q_pri_val_reg:			QUEUE_PRI_VAL register val
- * @rc_q_maxsize_reg:			RC_QUEUE_MAXSIZE register val
- * @bri_q_maxsize_reg:			BRI_QUEUE_MAXSIZE register val
- * @comp_resp_timeout_reg:		COMP_RESP_TIMEOUT register val
- * @bus_slave_control_reg:		BUS_SLAVE_CONTROL_REG register val
- * @deadlock_avoid_type_reg:		DEADLOCK_AVOID_TYPE register val
- * @intpin_reg_wpermit_reg0:		INTPIN_REG_WPERMIT register 0 val
- * @intpin_reg_wpermit_reg1:		INTPIN_REG_WPERMIT register 1 val
- * @intpin_reg_wpermit_reg2:		INTPIN_REG_WPERMIT register 2 val
- * @intpin_reg_wpermit_reg3:		INTPIN_REG_WPERMIT register 3 val
- * @int_reduce_control_reg:		INT_REDUCE_CONTROL registers val
- * @clkcfg_reg:				CLK CFG register val
- * @funcsel_reg:			Function select register value
  * @pch_phub_base_address:		Register base address
  * @pch_phub_extrom_base_address:	external rom base address
  * @pch_mac_start_address:		MAC address area start address
@@ -115,20 +101,6 @@ enum pch_phub_type {
  * @pdev:				pointer to pci device struct
  */
 struct pch_phub_reg {
-	u32 phub_id_reg;
-	u32 q_pri_val_reg;
-	u32 rc_q_maxsize_reg;
-	u32 bri_q_maxsize_reg;
-	u32 comp_resp_timeout_reg;
-	u32 bus_slave_control_reg;
-	u32 deadlock_avoid_type_reg;
-	u32 intpin_reg_wpermit_reg0;
-	u32 intpin_reg_wpermit_reg1;
-	u32 intpin_reg_wpermit_reg2;
-	u32 intpin_reg_wpermit_reg3;
-	u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG];
-	u32 clkcfg_reg;
-	u32 funcsel_reg;
 	void __iomem *pch_phub_base_address;
 	void __iomem *pch_phub_extrom_base_address;
 	u32 pch_mac_start_address;
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 3/3] misc: pch_phub: Make MAC address configuration more robust
  2026-05-26  8:52 [PATCH v1 0/3] misc: pch_phub: Fix fallout and more cleanup Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 1/3] misc: pch_phub: Complete enum usage for device identification Uwe Kleine-König (The Capable Hub)
  2026-05-26  8:52 ` [PATCH v1 2/3] misc: pch_phub: Drop unused members from struct pch_phub_reg Uwe Kleine-König (The Capable Hub)
@ 2026-05-26  8:52 ` Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26  8:52 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

The comment in pch_phub_write_gbe_mac_addr() suggests that only EG20T,
ML7831 and ML7223 are handled. Replace the code construct using an if
with a switch that has the same semantics but issues a warning if a new
device type is added to the driver without adapting this function.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/misc/pch_phub.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 5adf7f0c84ab..15785597da40 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -324,10 +324,19 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
 	int retval;
 	int i;
 
-	if (chip->ioh_type == PCH_EG20T || chip->ioh_type == PCH_ML7831)
+	switch (chip->ioh_type) {
+	case PCH_EG20T:
+	case PCH_ML7831:
 		retval = pch_phub_gbe_serial_rom_conf(chip);
-	else	/* ML7223 */
+		break;
+
+	case PCH_ML7213:
+	case PCH_ML7223M:
+	case PCH_ML7223N:
 		retval = pch_phub_gbe_serial_rom_conf_mp(chip);
+		break;
+	}
+
 	if (retval)
 		return retval;
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-26  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-26  8:52 [PATCH v1 0/3] misc: pch_phub: Fix fallout and more cleanup Uwe Kleine-König (The Capable Hub)
2026-05-26  8:52 ` [PATCH v1 1/3] misc: pch_phub: Complete enum usage for device identification Uwe Kleine-König (The Capable Hub)
2026-05-26  8:52 ` [PATCH v1 2/3] misc: pch_phub: Drop unused members from struct pch_phub_reg Uwe Kleine-König (The Capable Hub)
2026-05-26  8:52 ` [PATCH v1 3/3] misc: pch_phub: Make MAC address configuration more robust Uwe Kleine-König (The Capable Hub)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®