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

pwm: tegra: Rename variable pointing to driver private data

Status quo is that variables of type struct tegra_pwm_chip * are named
"pwm", "chip" or "pc". The two formers are all not optimal because
usually only struct pwm_device * variables are named "pwm" and "chip" is
usually used for variabled of type struct pwm_chip *.

So consistently use the same and non-conflicting name "pc".

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
f19460c1 22e8e19a

+29 -30
+29 -30
drivers/pwm/pwm-tegra.c
··· 85 85 return container_of(chip, struct tegra_pwm_chip, chip); 86 86 } 87 87 88 - static inline u32 pwm_readl(struct tegra_pwm_chip *chip, unsigned int num) 88 + static inline u32 pwm_readl(struct tegra_pwm_chip *pc, unsigned int offset) 89 89 { 90 - return readl(chip->regs + (num << 4)); 90 + return readl(pc->regs + (offset << 4)); 91 91 } 92 92 93 - static inline void pwm_writel(struct tegra_pwm_chip *chip, unsigned int num, 94 - unsigned long val) 93 + static inline void pwm_writel(struct tegra_pwm_chip *pc, unsigned int offset, u32 value) 95 94 { 96 - writel(val, chip->regs + (num << 4)); 95 + writel(value, pc->regs + (offset << 4)); 97 96 } 98 97 99 98 static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ··· 239 240 240 241 static int tegra_pwm_probe(struct platform_device *pdev) 241 242 { 242 - struct tegra_pwm_chip *pwm; 243 + struct tegra_pwm_chip *pc; 243 244 int ret; 244 245 245 - pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); 246 - if (!pwm) 246 + pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); 247 + if (!pc) 247 248 return -ENOMEM; 248 249 249 - pwm->soc = of_device_get_match_data(&pdev->dev); 250 - pwm->dev = &pdev->dev; 250 + pc->soc = of_device_get_match_data(&pdev->dev); 251 + pc->dev = &pdev->dev; 251 252 252 - pwm->regs = devm_platform_ioremap_resource(pdev, 0); 253 - if (IS_ERR(pwm->regs)) 254 - return PTR_ERR(pwm->regs); 253 + pc->regs = devm_platform_ioremap_resource(pdev, 0); 254 + if (IS_ERR(pc->regs)) 255 + return PTR_ERR(pc->regs); 255 256 256 - platform_set_drvdata(pdev, pwm); 257 + platform_set_drvdata(pdev, pc); 257 258 258 - pwm->clk = devm_clk_get(&pdev->dev, NULL); 259 - if (IS_ERR(pwm->clk)) 260 - return PTR_ERR(pwm->clk); 259 + pc->clk = devm_clk_get(&pdev->dev, NULL); 260 + if (IS_ERR(pc->clk)) 261 + return PTR_ERR(pc->clk); 261 262 262 263 ret = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); 263 264 if (ret) ··· 269 270 return ret; 270 271 271 272 /* Set maximum frequency of the IP */ 272 - ret = dev_pm_opp_set_rate(pwm->dev, pwm->soc->max_frequency); 273 + ret = dev_pm_opp_set_rate(pc->dev, pc->soc->max_frequency); 273 274 if (ret < 0) { 274 275 dev_err(&pdev->dev, "Failed to set max frequency: %d\n", ret); 275 276 goto put_pm; ··· 280 281 * clock register resolutions. Get the configured frequency 281 282 * so that PWM period can be calculated more accurately. 282 283 */ 283 - pwm->clk_rate = clk_get_rate(pwm->clk); 284 + pc->clk_rate = clk_get_rate(pc->clk); 284 285 285 286 /* Set minimum limit of PWM period for the IP */ 286 - pwm->min_period_ns = 287 - (NSEC_PER_SEC / (pwm->soc->max_frequency >> PWM_DUTY_WIDTH)) + 1; 287 + pc->min_period_ns = 288 + (NSEC_PER_SEC / (pc->soc->max_frequency >> PWM_DUTY_WIDTH)) + 1; 288 289 289 - pwm->rst = devm_reset_control_get_exclusive(&pdev->dev, "pwm"); 290 - if (IS_ERR(pwm->rst)) { 291 - ret = PTR_ERR(pwm->rst); 290 + pc->rst = devm_reset_control_get_exclusive(&pdev->dev, "pwm"); 291 + if (IS_ERR(pc->rst)) { 292 + ret = PTR_ERR(pc->rst); 292 293 dev_err(&pdev->dev, "Reset control is not found: %d\n", ret); 293 294 goto put_pm; 294 295 } 295 296 296 - reset_control_deassert(pwm->rst); 297 + reset_control_deassert(pc->rst); 297 298 298 - pwm->chip.dev = &pdev->dev; 299 - pwm->chip.ops = &tegra_pwm_ops; 300 - pwm->chip.npwm = pwm->soc->num_channels; 299 + pc->chip.dev = &pdev->dev; 300 + pc->chip.ops = &tegra_pwm_ops; 301 + pc->chip.npwm = pc->soc->num_channels; 301 302 302 - ret = pwmchip_add(&pwm->chip); 303 + ret = pwmchip_add(&pc->chip); 303 304 if (ret < 0) { 304 305 dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); 305 - reset_control_assert(pwm->rst); 306 + reset_control_assert(pc->rst); 306 307 goto put_pm; 307 308 } 308 309