mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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>
This commit is contained in:
@@ -628,7 +628,7 @@ static int pwrseq_match_device(struct device *pwrseq_dev, void *data)
|
||||
return 0;
|
||||
|
||||
ret = pwrseq->match(pwrseq, match_data->dev);
|
||||
if (ret <= 0)
|
||||
if (ret == PWRSEQ_NO_MATCH || ret < 0)
|
||||
return ret;
|
||||
|
||||
/* We got the matching device, let's find the right target. */
|
||||
@@ -651,7 +651,7 @@ static int pwrseq_match_device(struct device *pwrseq_dev, void *data)
|
||||
|
||||
match_data->desc->pwrseq = pwrseq_device_get(pwrseq);
|
||||
|
||||
return 1;
|
||||
return PWRSEQ_MATCH_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -684,7 +684,7 @@ struct pwrseq_desc *pwrseq_get(struct device *dev, const char *target)
|
||||
pwrseq_match_device);
|
||||
if (ret < 0)
|
||||
return ERR_PTR(ret);
|
||||
if (ret == 0)
|
||||
if (ret == PWRSEQ_NO_MATCH)
|
||||
/* No device matched. */
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ struct pwrseq_device;
|
||||
typedef int (*pwrseq_power_state_func)(struct pwrseq_device *);
|
||||
typedef int (*pwrseq_match_func)(struct pwrseq_device *, struct device *);
|
||||
|
||||
#define PWRSEQ_NO_MATCH 0
|
||||
#define PWRSEQ_MATCH_OK 1
|
||||
|
||||
/**
|
||||
* struct pwrseq_unit_data - Configuration of a single power sequencing
|
||||
* unit.
|
||||
|
||||
Reference in New Issue
Block a user