Skip to content

Commit b4f78ff

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
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: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 06c2afb commit b4f78ff

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

drivers/pwm/core.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,28 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label)
127127
}
128128

129129
struct pwm_device *
130-
of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
130+
of_pwm_xlate_with_flags(struct pwm_chip *chip, const struct of_phandle_args *args)
131131
{
132132
struct pwm_device *pwm;
133133

134-
if (pc->of_pwm_n_cells < 2)
134+
if (chip->of_pwm_n_cells < 2)
135135
return ERR_PTR(-EINVAL);
136136

137137
/* flags in the third cell are optional */
138138
if (args->args_count < 2)
139139
return ERR_PTR(-EINVAL);
140140

141-
if (args->args[0] >= pc->npwm)
141+
if (args->args[0] >= chip->npwm)
142142
return ERR_PTR(-EINVAL);
143143

144-
pwm = pwm_request_from_chip(pc, args->args[0], NULL);
144+
pwm = pwm_request_from_chip(chip, args->args[0], NULL);
145145
if (IS_ERR(pwm))
146146
return pwm;
147147

148148
pwm->args.period = args->args[1];
149149
pwm->args.polarity = PWM_POLARITY_NORMAL;
150150

151-
if (pc->of_pwm_n_cells >= 3) {
151+
if (chip->of_pwm_n_cells >= 3) {
152152
if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED)
153153
pwm->args.polarity = PWM_POLARITY_INVERSED;
154154
}
@@ -158,18 +158,18 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
158158
EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags);
159159

160160
struct pwm_device *
161-
of_pwm_single_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
161+
of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args)
162162
{
163163
struct pwm_device *pwm;
164164

165-
if (pc->of_pwm_n_cells < 1)
165+
if (chip->of_pwm_n_cells < 1)
166166
return ERR_PTR(-EINVAL);
167167

168168
/* validate that one cell is specified, optionally with flags */
169169
if (args->args_count != 1 && args->args_count != 2)
170170
return ERR_PTR(-EINVAL);
171171

172-
pwm = pwm_request_from_chip(pc, 0, NULL);
172+
pwm = pwm_request_from_chip(chip, 0, NULL);
173173
if (IS_ERR(pwm))
174174
return pwm;
175175

@@ -692,7 +692,7 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
692692
struct pwm_device *pwm = NULL;
693693
struct of_phandle_args args;
694694
struct device_link *dl;
695-
struct pwm_chip *pc;
695+
struct pwm_chip *chip;
696696
int index = 0;
697697
int err;
698698

@@ -709,16 +709,16 @@ static struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
709709
return ERR_PTR(err);
710710
}
711711

712-
pc = fwnode_to_pwmchip(of_fwnode_handle(args.np));
713-
if (IS_ERR(pc)) {
714-
if (PTR_ERR(pc) != -EPROBE_DEFER)
712+
chip = fwnode_to_pwmchip(of_fwnode_handle(args.np));
713+
if (IS_ERR(chip)) {
714+
if (PTR_ERR(chip) != -EPROBE_DEFER)
715715
pr_err("%s(): PWM chip not found\n", __func__);
716716

717-
pwm = ERR_CAST(pc);
717+
pwm = ERR_CAST(chip);
718718
goto put;
719719
}
720720

721-
pwm = pc->of_xlate(pc, &args);
721+
pwm = chip->of_xlate(chip, &args);
722722
if (IS_ERR(pwm))
723723
goto put;
724724

include/linux/pwm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ struct pwm_chip {
298298
int base;
299299
unsigned int npwm;
300300

301-
struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
301+
struct pwm_device * (*of_xlate)(struct pwm_chip *chip,
302302
const struct of_phandle_args *args);
303303
unsigned int of_pwm_n_cells;
304304

@@ -395,9 +395,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
395395
unsigned int index,
396396
const char *label);
397397

398-
struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
398+
struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *chip,
399399
const struct of_phandle_args *args);
400-
struct pwm_device *of_pwm_single_xlate(struct pwm_chip *pc,
400+
struct pwm_device *of_pwm_single_xlate(struct pwm_chip *chip,
401401
const struct of_phandle_args *args);
402402

403403
struct pwm_device *pwm_get(struct device *dev, const char *con_id);

0 commit comments

Comments
 (0)