mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
gpio: pch: Cache &pdev->dev to reduce repetition
pch_gpio_probe() repeats the "&pdev->dev" expression several times. Cache the result as "struct device *dev" to reduce the repetition. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
82b2cd4c8c
commit
2822b02765
|
|
@ -346,24 +346,25 @@ static int pch_gpio_alloc_generic_chip(struct pch_gpio *chip,
|
|||
static int pch_gpio_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
s32 ret;
|
||||
struct pch_gpio *chip;
|
||||
int irq_base;
|
||||
|
||||
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
|
||||
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
|
||||
if (chip == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
chip->dev = &pdev->dev;
|
||||
chip->dev = dev;
|
||||
ret = pcim_enable_device(pdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "pci_enable_device FAILED");
|
||||
dev_err(dev, "pci_enable_device FAILED");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pcim_iomap_regions(pdev, BIT(1), KBUILD_MODNAME);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "pci_request_regions FAILED-%d", ret);
|
||||
dev_err(dev, "pci_request_regions FAILED-%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -374,16 +375,16 @@ static int pch_gpio_probe(struct pci_dev *pdev,
|
|||
spin_lock_init(&chip->spinlock);
|
||||
pch_gpio_setup(chip);
|
||||
|
||||
ret = devm_gpiochip_add_data(&pdev->dev, &chip->gpio, chip);
|
||||
ret = devm_gpiochip_add_data(dev, &chip->gpio, chip);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "PCH gpio: Failed to register GPIO\n");
|
||||
dev_err(dev, "PCH gpio: Failed to register GPIO\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0,
|
||||
irq_base = devm_irq_alloc_descs(dev, -1, 0,
|
||||
gpio_pins[chip->ioh], NUMA_NO_NODE);
|
||||
if (irq_base < 0) {
|
||||
dev_warn(&pdev->dev, "PCH gpio: Failed to get IRQ base num\n");
|
||||
dev_warn(dev, "PCH gpio: Failed to get IRQ base num\n");
|
||||
chip->irq_base = -1;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -393,10 +394,10 @@ static int pch_gpio_probe(struct pci_dev *pdev,
|
|||
iowrite32(BIT(gpio_pins[chip->ioh]) - 1, &chip->reg->imask);
|
||||
iowrite32(BIT(gpio_pins[chip->ioh]) - 1, &chip->reg->ien);
|
||||
|
||||
ret = devm_request_irq(&pdev->dev, pdev->irq, pch_gpio_handler,
|
||||
ret = devm_request_irq(dev, pdev->irq, pch_gpio_handler,
|
||||
IRQF_SHARED, KBUILD_MODNAME, chip);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "request_irq failed\n");
|
||||
dev_err(dev, "request_irq failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user