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

power: sequencing: add defines for return values of the match() callback

Instead of using 0 and 1 as magic numbers, let's add proper defines
whose names tell the reader what the meaning behind them is.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20250624-pwrseq-match-defines-v1-3-a59d90a951f1@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

+6 -3
+3 -3
drivers/power/sequencing/core.c
··· 628 628 return 0; 629 629 630 630 ret = pwrseq->match(pwrseq, match_data->dev); 631 - if (ret <= 0) 631 + if (ret == PWRSEQ_NO_MATCH || ret < 0) 632 632 return ret; 633 633 634 634 /* We got the matching device, let's find the right target. */ ··· 651 651 652 652 match_data->desc->pwrseq = pwrseq_device_get(pwrseq); 653 653 654 - return 1; 654 + return PWRSEQ_MATCH_OK; 655 655 } 656 656 657 657 /** ··· 684 684 pwrseq_match_device); 685 685 if (ret < 0) 686 686 return ERR_PTR(ret); 687 - if (ret == 0) 687 + if (ret == PWRSEQ_NO_MATCH) 688 688 /* No device matched. */ 689 689 return ERR_PTR(-EPROBE_DEFER); 690 690
+3
include/linux/pwrseq/provider.h
··· 13 13 typedef int (*pwrseq_power_state_func)(struct pwrseq_device *); 14 14 typedef int (*pwrseq_match_func)(struct pwrseq_device *, struct device *); 15 15 16 + #define PWRSEQ_NO_MATCH 0 17 + #define PWRSEQ_MATCH_OK 1 18 + 16 19 /** 17 20 * struct pwrseq_unit_data - Configuration of a single power sequencing 18 21 * unit.