Commit b4f78ff7 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: Use a consistent name for pwm_chip pointers in the core

Most variables of type struct pwm_chip * are named "chip", there are
only three outliers called "pc". Change these three to "chip", too, for
consistency.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 06c2afb8
...@@ -127,28 +127,28 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) ...@@ -127,28 +127,28 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label)
} }
struct pwm_device * struct pwm_device *
of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_args *args)
{ {
struct pwm_device *pwm; struct pwm_device *pwm;
if (pc->of_pwm_n_cells < 2) if (chip->of_pwm_n_cells < 2)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* flags in the third cell are optional */ /* flags in the third cell are optional */
if (args->args_count < 2) if (args->args_count < 2)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (args->args[0] >= pc->npwm) if (args->args[0] >= chip->npwm)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
pwm = pwm_request_from_chip(pc, args->args[0], NULL); pwm = pwm_request_from_chip(chip, args->args[0], NULL);
if (IS_ERR(pwm)) if (IS_ERR(pwm))
return pwm; return pwm;
pwm->args.period = args->args[1]; pwm->args.period = args->args[1];
pwm->args.polarity = PWM_POLARITY_NORMAL; pwm->args.polarity = PWM_POLARITY_NORMAL;
if (pc->of_pwm_n_cells >= 3) { if (chip->of_pwm_n_cells >= 3) {
if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED) if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED)
pwm->args.polarity = PWM_POLARITY_INVERSED; pwm->args.polarity = PWM_POLARITY_INVERSED;
} }
...@@ -158,18 +158,18 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) ...@@ -158,18 +158,18 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags); EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags);
struct pwm_device * struct pwm_device *
of_pwm_single_xlate(struct pwm_chip *pc, const struct of_phandle_args *args) of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args)
{ {
struct pwm_device *pwm; struct pwm_device *pwm;
if (pc->of_pwm_n_cells < 1) if (chip->of_pwm_n_cells < 1)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* validate that one cell is specified, optionally with flags */ /* validate that one cell is specified, optionally with flags */
if (args->args_count != 1 && args->args_count != 2) if (args->args_count != 1 && args->args_count != 2)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
pwm = pwm_request_from_chip(pc, 0, NULL); pwm = pwm_request_from_chip(chip, 0, NULL);
if (IS_ERR(pwm)) if (IS_ERR(pwm))
return pwm; return pwm;
...@@ -692,7 +692,7 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np, ...@@ -692,7 +692,7 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
struct pwm_device *pwm = NULL; struct pwm_device *pwm = NULL;
struct of_phandle_args args; struct of_phandle_args args;
struct device_link *dl; struct device_link *dl;
struct pwm_chip *pc; struct pwm_chip *chip;
int index = 0; int index = 0;
int err; int err;
...@@ -709,16 +709,16 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np, ...@@ -709,16 +709,16 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
return ERR_PTR(err); return ERR_PTR(err);
} }
pc = fwnode_to_pwmchip(of_fwnode_handle(args.np)); chip = fwnode_to_pwmchip(of_fwnode_handle(args.np));
if (IS_ERR(pc)) { if (IS_ERR(chip)) {
if (PTR_ERR(pc) != -EPROBE_DEFER) if (PTR_ERR(chip) != -EPROBE_DEFER)
pr_err("%s(): PWM chip not found\n", __func__); pr_err("%s(): PWM chip not found\n", __func__);
pwm = ERR_CAST(pc); pwm = ERR_CAST(chip);
goto put; goto put;
} }
pwm = pc->of_xlate(pc, &args); pwm = chip->of_xlate(chip, &args);
if (IS_ERR(pwm)) if (IS_ERR(pwm))
goto put; goto put;
......
...@@ -298,7 +298,7 @@ struct pwm_chip { ...@@ -298,7 +298,7 @@ struct pwm_chip {
int base; int base;
unsigned int npwm; unsigned int npwm;
struct pwm_device * (*of_xlate)(struct pwm_chip *pc, struct pwm_device * (*of_xlate)(struct pwm_chip *chip,
const struct of_phandle_args *args); const struct of_phandle_args *args);
unsigned int of_pwm_n_cells; unsigned int of_pwm_n_cells;
...@@ -395,9 +395,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, ...@@ -395,9 +395,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
unsigned int index, unsigned int index,
const char *label); const char *label);
struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc, struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *chip,
const struct of_phandle_args *args); const struct of_phandle_args *args);
struct pwm_device *of_pwm_single_xlate(struct pwm_chip *pc, struct pwm_device *of_pwm_single_xlate(struct pwm_chip *chip,
const struct of_phandle_args *args); const struct of_phandle_args *args);
struct pwm_device *pwm_get(struct device *dev, const char *con_id); struct pwm_device *pwm_get(struct device *dev, const char *con_id);
......
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