Re: [RFC] pci_name()

Matthew Wilcox (willy@debian.org)
Thu, 26 Jun 2003 03:52:10 +0100


On Thu, Jun 26, 2003 at 03:50:57AM +0100, Matthew Wilcox wrote:
> On Wed, Jun 25, 2003 at 06:02:40PM -0700, Greg KH wrote:
> > Ok, I'll buy that, feel free to send the patch :)
>
> It's kind of late to be writing patches ... but this boots & works for me.

Here's an example of converting a driver (tg3, just to annoy jeff ;-) to
pci_name().

Index: drivers/net/tg3.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/net/tg3.c,v
retrieving revision 1.16
diff -u -p -r1.16 tg3.c
--- drivers/net/tg3.c 14 Jun 2003 22:15:21 -0000 1.16
+++ drivers/net/tg3.c 26 Jun 2003 02:45:54 -0000
@@ -5118,7 +5118,7 @@ static int tg3_ethtool_ioctl (struct net
strcpy (info.driver, DRV_MODULE_NAME);
strcpy (info.version, DRV_MODULE_VERSION);
memset(&info.fw_version, 0, sizeof(info.fw_version));
- strcpy (info.bus_info, pci_dev->slot_name);
+ strcpy (info.bus_info, pci_name(pci_dev));
info.eedump_len = 0;
info.regdump_len = TG3_REGDUMP_LEN;
if (copy_to_user (useraddr, &info, sizeof (info)))
@@ -6087,7 +6087,7 @@ static int __devinit tg3_get_invariants(
err = tg3_set_power_state(tp, 0);
if (err) {
printk(KERN_ERR PFX "(%s) transition to D0 failed\n",
- tp->pdev->slot_name);
+ pci_name(tp->pdev));
return err;
}

@@ -6198,7 +6198,7 @@ static int __devinit tg3_get_invariants(
err = tg3_phy_probe(tp);
if (err) {
printk(KERN_ERR PFX "(%s) phy probe failed, err %d\n",
- tp->pdev->slot_name, err);
+ pci_name(tp->pdev), err);
/* ... but do not return immediately ... */
}

@@ -6682,7 +6682,7 @@ static int __devinit tg3_init_one(struct
if (!pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL)) {
pci_using_dac = 1;
if (pci_set_consistent_dma_mask(pdev,
- (u64) 0xffffffffffffffff)) {
+ (u64) 0xffffffffffffffffULL)) {
printk(KERN_ERR PFX "Unable to obtain 64 bit DMA "
"for consistent allocations\n");
goto err_out_free_res;

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/