Skip to content

Commit 5739cf1

Browse files
committed
i2c: i801: Cosmetic improvements
JIRA: https://issues.redhat.com/browse/RHEL-113184 commit 9d515bf Author: Heiner Kallweit <hkallweit1@gmail.com> Date: Fri Feb 21 21:28:21 2025 +0100 i2c: i801: Cosmetic improvements - Use pci_err et al instead of dev_err to simplify the code - use format %pr to print resource Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/6676001a-a584-46e2-a98e-17163d82c218@gmail.com Signed-off-by: Steve Best <sbest@redhat.com>
1 parent 4548f56 commit 5739cf1

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

drivers/i2c/busses/i2c-i801.c

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -412,16 +412,14 @@ static int i801_check_post(struct i801_priv *priv, int status)
412412

413413
/* Check if it worked */
414414
status = inb_p(SMBHSTSTS(priv));
415-
if ((status & SMBHSTSTS_HOST_BUSY) ||
416-
!(status & SMBHSTSTS_FAILED))
417-
dev_dbg(&priv->pci_dev->dev,
418-
"Failed terminating the transaction\n");
415+
if ((status & SMBHSTSTS_HOST_BUSY) || !(status & SMBHSTSTS_FAILED))
416+
pci_dbg(priv->pci_dev, "Failed terminating the transaction\n");
419417
return -ETIMEDOUT;
420418
}
421419

422420
if (status & SMBHSTSTS_FAILED) {
423421
result = -EIO;
424-
dev_err(&priv->pci_dev->dev, "Transaction failed\n");
422+
pci_err(priv->pci_dev, "Transaction failed\n");
425423
}
426424
if (status & SMBHSTSTS_DEV_ERR) {
427425
/*
@@ -449,7 +447,7 @@ static int i801_check_post(struct i801_priv *priv, int status)
449447
}
450448
if (status & SMBHSTSTS_BUS_ERR) {
451449
result = -EAGAIN;
452-
dev_dbg(&priv->pci_dev->dev, "Lost arbitration\n");
450+
pci_dbg(priv->pci_dev, "Lost arbitration\n");
453451
}
454452

455453
return result;
@@ -578,8 +576,7 @@ static void i801_isr_byte_done(struct i801_priv *priv)
578576
if (priv->count < priv->len)
579577
priv->data[priv->count++] = inb(SMBBLKDAT(priv));
580578
else
581-
dev_dbg(&priv->pci_dev->dev,
582-
"Discarding extra byte on block read\n");
579+
pci_dbg(priv->pci_dev, "Discarding extra byte on block read\n");
583580

584581
/* Set LAST_BYTE for last byte of read transaction */
585582
if (priv->count == priv->len - 1)
@@ -1438,7 +1435,7 @@ static void i801_add_tco(struct i801_priv *priv)
14381435
priv->tco_pdev = i801_add_tco_spt(pci_dev, tco_res);
14391436

14401437
if (IS_ERR(priv->tco_pdev))
1441-
dev_warn(&pci_dev->dev, "failed to create iTCO device\n");
1438+
pci_warn(pci_dev, "failed to create iTCO device\n");
14421439
}
14431440

14441441
#ifdef CONFIG_ACPI
@@ -1467,8 +1464,8 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
14671464
if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) {
14681465
priv->acpi_reserved = true;
14691466

1470-
dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");
1471-
dev_warn(&pdev->dev, "Driver SMBus register access inhibited\n");
1467+
pci_warn(pdev, "BIOS is accessing SMBus registers\n");
1468+
pci_warn(pdev, "Driver SMBus register access inhibited\n");
14721469

14731470
/*
14741471
* BIOS is accessing the host controller so prevent it from
@@ -1549,8 +1546,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
15491546
/* Disable features on user request */
15501547
for (i = 0; i < ARRAY_SIZE(i801_feature_names); i++) {
15511548
if (priv->features & disable_features & (1 << i))
1552-
dev_notice(&dev->dev, "%s disabled by user\n",
1553-
i801_feature_names[i]);
1549+
pci_notice(dev, "%s disabled by user\n", i801_feature_names[i]);
15541550
}
15551551
priv->features &= ~disable_features;
15561552

@@ -1564,16 +1560,14 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
15641560
*/
15651561
err = pci_enable_device(dev);
15661562
if (err) {
1567-
dev_err(&dev->dev, "Failed to enable SMBus PCI device (%d)\n",
1568-
err);
1563+
pci_err(dev, "Failed to enable SMBus PCI device (%d)\n", err);
15691564
return err;
15701565
}
15711566

15721567
/* Determine the address of the SMBus area */
15731568
priv->smba = pci_resource_start(dev, SMBBAR);
15741569
if (!priv->smba) {
1575-
dev_err(&dev->dev,
1576-
"SMBus base address uninitialized, upgrade BIOS\n");
1570+
pci_err(dev, "SMBus base address uninitialized, upgrade BIOS\n");
15771571
return -ENODEV;
15781572
}
15791573

@@ -1582,26 +1576,24 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
15821576

15831577
err = pcim_iomap_regions(dev, 1 << SMBBAR, DRV_NAME);
15841578
if (err) {
1585-
dev_err(&dev->dev,
1586-
"Failed to request SMBus region 0x%lx-0x%Lx\n",
1587-
priv->smba,
1588-
(unsigned long long)pci_resource_end(dev, SMBBAR));
1579+
pci_err(dev, "Failed to request SMBus region %pr\n",
1580+
pci_resource_n(dev, SMBBAR));
15891581
i801_acpi_remove(priv);
15901582
return err;
15911583
}
15921584

1593-
pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &priv->original_hstcfg);
1585+
pci_read_config_byte(dev, SMBHSTCFG, &priv->original_hstcfg);
15941586
i801_setup_hstcfg(priv);
15951587
if (!(priv->original_hstcfg & SMBHSTCFG_HST_EN))
1596-
dev_info(&dev->dev, "Enabling SMBus device\n");
1588+
pci_info(dev, "Enabling SMBus device\n");
15971589

15981590
if (priv->original_hstcfg & SMBHSTCFG_SMB_SMI_EN) {
1599-
dev_dbg(&dev->dev, "SMBus using interrupt SMI#\n");
1591+
pci_dbg(dev, "SMBus using interrupt SMI#\n");
16001592
/* Disable SMBus interrupt feature if SMBus using SMI# */
16011593
priv->features &= ~FEATURE_IRQ;
16021594
}
16031595
if (priv->original_hstcfg & SMBHSTCFG_SPD_WD)
1604-
dev_info(&dev->dev, "SPD Write Disable is set\n");
1596+
pci_info(dev, "SPD Write Disable is set\n");
16051597

16061598
/* Clear special mode bits */
16071599
if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))
@@ -1620,7 +1612,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
16201612
/* Complain if an interrupt is already pending */
16211613
pci_read_config_word(priv->pci_dev, PCI_STATUS, &pcists);
16221614
if (pcists & PCI_STATUS_INTERRUPT)
1623-
dev_warn(&dev->dev, "An interrupt is pending!\n");
1615+
pci_warn(dev, "An interrupt is pending!\n");
16241616
}
16251617

16261618
if (priv->features & FEATURE_IRQ) {
@@ -1629,12 +1621,11 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
16291621
err = devm_request_irq(&dev->dev, dev->irq, i801_isr,
16301622
IRQF_SHARED, DRV_NAME, priv);
16311623
if (err) {
1632-
dev_err(&dev->dev, "Failed to allocate irq %d: %d\n",
1633-
dev->irq, err);
1624+
pci_err(dev, "Failed to allocate irq %d: %d\n", dev->irq, err);
16341625
priv->features &= ~FEATURE_IRQ;
16351626
}
16361627
}
1637-
dev_info(&dev->dev, "SMBus using %s\n",
1628+
pci_info(dev, "SMBus using %s\n",
16381629
priv->features & FEATURE_IRQ ? "PCI interrupt" : "polling");
16391630

16401631
/* Host notification uses an interrupt */

0 commit comments

Comments
 (0)