hw/phb4: Use standard MIN/MAX macro definitions
diff mbox series

Message ID 20190808051008.6962-1-jniethe5@gmail.com
State Superseded
Headers show
Series
  • hw/phb4: Use standard MIN/MAX macro definitions
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (0e1db80c70477d89a73c7f2a1a7e19c7d8292c5f)

Commit Message

Jordan Niethe Aug. 8, 2019, 5:10 a.m. UTC
The max() macro definition actually returns the smallest value.  Macro
definitions for MIN and MAX are already provided in skiboot.h.  Remove
the redundant/incorrect versions here and switch to using the standard
ones.

Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
 hw/phb4.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/hw/phb4.c b/hw/phb4.c
index 39d0151c9aa1..a8fbf817ad2c 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2574,9 +2574,6 @@  static void phb4_lane_eq_change(struct phb4 *p, uint32_t vdid)
 	p->lane_eq_en = !phb4_lane_eq_retry_whitelist(vdid);
 }
 
-#define min(x,y) ((x) < (y) ? x : y)
-#define max(x,y) ((x) < (y) ? x : y)
-
 static bool phb4_link_optimal(struct pci_slot *slot, uint32_t *vdid)
 {
 	struct phb4 *p = phb_to_phb4(slot->phb);
@@ -2603,9 +2600,9 @@  static bool phb4_link_optimal(struct pci_slot *slot, uint32_t *vdid)
 	phb4_get_info(slot->phb, bdfn, &dev_speed, &dev_width);
 
 	/* Work out if we are optimally trained */
-	target_speed = min(phb_speed, dev_speed);
+	target_speed = MIN(phb_speed, dev_speed);
 	optimal_speed = (trained_speed >= target_speed);
-	target_width = min(phb_width, dev_width);
+	target_width = MIN(phb_width, dev_width);
 	optimal_width = (trained_width >= target_width);
 	optimal = optimal_width && optimal_speed;
 	retry_enabled = (phb4_chip_retry_workaround() &&
@@ -3366,7 +3363,7 @@  static int64_t phb4_creset(struct pci_slot *slot)
 		 */
 		creset_time = tb_to_msecs(mftb() - p->creset_start_time);
 		if (creset_time < 250)
-			wait_time = max(100, 250 - creset_time);
+			wait_time = MAX(100, 250 - creset_time);
 		else
 			wait_time = 100;
 		PHBDBG(p, "CRESET: wait_time = %lld\n", wait_time);