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

Configure Feed

Select the types of activity you want to include in your feed.

PCI/pwrctrl: tc9563: Add local variables to reduce repetition

Add local struct device * and struct device_node * variables to reduce
repetitive pointer chasing. No functional changes intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260115-pci-pwrctrl-rework-v5-5-9d26da3ce903@oss.qualcomm.com

+12 -10
+12 -10
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
··· 459 459 460 460 static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctrl_ctx *ctx) 461 461 { 462 + struct device *dev = ctx->pwrctrl.dev; 462 463 struct tc9563_pwrctrl_cfg *cfg; 463 464 int ret, i; 464 465 465 466 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); 466 467 if (ret < 0) 467 - return dev_err_probe(ctx->pwrctrl.dev, ret, "cannot enable regulators\n"); 468 + return dev_err_probe(dev, ret, "cannot enable regulators\n"); 468 469 469 470 gpiod_set_value(ctx->reset_gpio, 0); 470 471 ··· 479 478 cfg = &ctx->cfg[i]; 480 479 ret = tc9563_pwrctrl_disable_port(ctx, i); 481 480 if (ret) { 482 - dev_err(ctx->pwrctrl.dev, "Disabling port failed\n"); 481 + dev_err(dev, "Disabling port failed\n"); 483 482 goto power_off; 484 483 } 485 484 486 485 ret = tc9563_pwrctrl_set_l0s_l1_entry_delay(ctx, i, false, cfg->l0s_delay); 487 486 if (ret) { 488 - dev_err(ctx->pwrctrl.dev, "Setting L0s entry delay failed\n"); 487 + dev_err(dev, "Setting L0s entry delay failed\n"); 489 488 goto power_off; 490 489 } 491 490 492 491 ret = tc9563_pwrctrl_set_l0s_l1_entry_delay(ctx, i, true, cfg->l1_delay); 493 492 if (ret) { 494 - dev_err(ctx->pwrctrl.dev, "Setting L1 entry delay failed\n"); 493 + dev_err(dev, "Setting L1 entry delay failed\n"); 495 494 goto power_off; 496 495 } 497 496 498 497 ret = tc9563_pwrctrl_set_tx_amplitude(ctx, i); 499 498 if (ret) { 500 - dev_err(ctx->pwrctrl.dev, "Setting Tx amplitude failed\n"); 499 + dev_err(dev, "Setting Tx amplitude failed\n"); 501 500 goto power_off; 502 501 } 503 502 504 503 ret = tc9563_pwrctrl_set_nfts(ctx, i); 505 504 if (ret) { 506 - dev_err(ctx->pwrctrl.dev, "Setting N_FTS failed\n"); 505 + dev_err(dev, "Setting N_FTS failed\n"); 507 506 goto power_off; 508 507 } 509 508 510 509 ret = tc9563_pwrctrl_disable_dfe(ctx, i); 511 510 if (ret) { 512 - dev_err(ctx->pwrctrl.dev, "Disabling DFE failed\n"); 511 + dev_err(dev, "Disabling DFE failed\n"); 513 512 goto power_off; 514 513 } 515 514 } ··· 526 525 static int tc9563_pwrctrl_probe(struct platform_device *pdev) 527 526 { 528 527 struct pci_host_bridge *bridge = to_pci_host_bridge(pdev->dev.parent); 528 + struct device_node *node = pdev->dev.of_node; 529 529 struct pci_bus *bus = bridge->bus; 530 530 struct device *dev = &pdev->dev; 531 531 enum tc9563_pwrctrl_ports port; ··· 538 536 if (!ctx) 539 537 return -ENOMEM; 540 538 541 - ret = of_property_read_u32_index(pdev->dev.of_node, "i2c-parent", 1, &addr); 539 + ret = of_property_read_u32_index(node, "i2c-parent", 1, &addr); 542 540 if (ret) 543 541 return dev_err_probe(dev, ret, "Failed to read i2c-parent property\n"); 544 542 ··· 574 572 pci_pwrctrl_init(&ctx->pwrctrl, dev); 575 573 576 574 port = TC9563_USP; 577 - ret = tc9563_pwrctrl_parse_device_dt(ctx, pdev->dev.of_node, port); 575 + ret = tc9563_pwrctrl_parse_device_dt(ctx, node, port); 578 576 if (ret) { 579 577 dev_err(dev, "failed to parse device tree properties: %d\n", ret); 580 578 goto remove_i2c; ··· 585 583 * The first node represents DSP1, the second node represents DSP2, 586 584 * and so on. 587 585 */ 588 - for_each_child_of_node_scoped(pdev->dev.of_node, child) { 586 + for_each_child_of_node_scoped(node, child) { 589 587 port++; 590 588 ret = tc9563_pwrctrl_parse_device_dt(ctx, child, port); 591 589 if (ret)