login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
September
»
9
Re: [PATCH 3/3] sky2: use pci_read_vpd to read info during boot
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Jesse Barnes
Subject:
Re: [PATCH 3/3] sky2: use pci_read_vpd to read info during boot
Date: Monday, September 8, 2008 - 9:36 pm
On Thursday, September 04, 2008 12:36 am Jeff Garzik wrote:
quoted text
> Stephen Hemminger wrote: > > Change sky2 driver (in netdev next tree) to use vpd access routines. > > > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > > > Note: other usage of vpd internal access routines will go away in later > > patches. > > > > --- > > Patch against netdev-2.6#upstream-next assumes the previous PCI API > > change. > > > > --- a/drivers/net/sky2.c 2008-09-03 11:35:47.000000000 -0700 > > +++ b/drivers/net/sky2.c 2008-09-03 11:44:06.000000000 -0700 > > @@ -4199,10 +4199,9 @@ static int __devinit pci_wake_enabled(st > > > > static void __devinit sky2_vpd_info(struct sky2_hw *hw) > > { > > - int cap = pci_find_capability(hw->pdev, PCI_CAP_ID_VPD); > > - const u8 *p; > > - u8 *vpd_buf = NULL; > > - u16 len; > > + loff_t offs; > > + u8 len; > > + u8 tag[3]; > > static struct vpd_tag { > > char tag[2]; > > char *label; > > @@ -4211,47 +4210,48 @@ static void __devinit sky2_vpd_info(stru > > { "EC", "Engineering Level" }, > > { "MN", "Manufacturer" }, > > }; > > + char str[128]; > > > > - if (!cap) > > - goto out; > > - > > - vpd_buf = kmalloc(VPD_SIZE, GFP_KERNEL); > > - if (!vpd_buf) > > - goto out; > > + if (pci_read_vpd(hw->pdev, 0, sizeof(tag), tag) < 0) > > + return; > > + if (tag[0] != VPD_MAGIC) > > + return; > > + len = tag[1]; > > + if (len == 0 || len > sizeof(str)) > > + return; > > > > - if (sky2_vpd_read(hw, cap, vpd_buf, 0, VPD_SIZE)) > > - goto out; > > + offs = 3; > > + if (pci_read_vpd(hw->pdev, offs, len, str) < 0) > > + return; > > > > - if (vpd_buf[0] != VPD_MAGIC) > > - goto out; > > - len = vpd_buf[1]; > > - if (len == 0 || len > VPD_SIZE - 4) > > - goto out; > > - p = vpd_buf + 3; > > - dev_info(&hw->pdev->dev, "%.*s\n", len, p); > > - p += len; > > + dev_info(&hw->pdev->dev, "%.*s\n", len, str); > > > > - while (p < vpd_buf + VPD_SIZE - 4) { > > + for(;;) { > > int i; > > > > - if (!memcmp("RW", p, 2)) /* end marker */ > > + offs += len; > > + if (pci_read_vpd(hw->pdev, offs, sizeof(tag), tag) < 0) > > break; > > > > - len = p[2]; > > - if (len > (p - vpd_buf) - 4) > > + if (!memcmp("RW", tag, 2)) /* end marker */ > > + break; > > + > > + offs += sizeof(tag); > > + len = tag[2]; > > + if (len > sizeof(str)) > > break; > > > > for (i = 0; i < ARRAY_SIZE(vpd_tags); i++) { > > - if (!memcmp(vpd_tags[i].tag, p, 2)) { > > + if (!memcmp(vpd_tags[i].tag, tag, 2)) { > > + if (pci_read_vpd(hw->pdev, offs, len, str) < 0) > > + return; > > + > > printk(KERN_DEBUG " %s: %.*s\n", > > - vpd_tags[i].label, len, p + 3); > > + vpd_tags[i].label, len, str); > > break; > > } > > } > > - p += len + 3; > > } > > -out: > > - kfree(vpd_buf); > > } > > Acked-by: me > > I presume this will go via PCI tree?
The sky2 bits too? Sure, that's fine with me. I'll stuff it into my linux-next tree tomorrow after a quick look. Thanks, Jesse --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH 2/3] pci: revise VPD access interface
, Stephen Hemminger
, (Wed Sep 3, 3:57 pm)
[PATCH 3/3] sky2: use pci_read_vpd to read info during boot
, Stephen Hemminger
, (Wed Sep 3, 4:00 pm)
Re: [PATCH 3/3] sky2: use pci_read_vpd to read info during ...
, Jeff Garzik
, (Thu Sep 4, 12:36 am)
Re: [PATCH 3/3] sky2: use pci_read_vpd to read info during ...
, Jesse Barnes
, (Mon Sep 8, 9:36 pm)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ken Chen
[patch] sched: fix inconsistency when redistribute per-cpu tg->cfs_rq shares.
Hugh Dickins
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad
Bernhard Beck
[PATCH 001/001] usb-serial: Add ThinkOptics WavIT
Oleg Nesterov
Re: [PATCH 4/5] don't panic if /sbin/init exits or killed
Greg KH
[patch 07/21] rtc-pcf8563: detect polarity of century bit automatically
git
:
Jonathan del Strother
Re: [PATCH] Fixing path quoting issues
Gerrit Pape
[PATCH] fix skipping merge-order test with NO_OPENSSL=1.
Linus Torvalds
Re: Implementing branch attributes in git config
Johannes Schindelin
Re: Trying to use git-filter-branch to compress history by removing large, obsolet...
Gerrit Pape
[PATCH] hooks--update: fix test for properly set up project description file
linux-netdev
:
David Miller
Re: [PATCH 04/15] tg3: Preserve LAA when device control is released
Jean-Louis Dupond
Re: tg3 driver not advertising 1000mbit
Sven Wegener
[PATCH] ipvs: Add missing locking during connection table hashing and unhashing
David Miller
Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
Stephen Hemminger
[PATCH 2/2] sky2: fix transmit state on resume
git-commits-head
:
Linux Kernel Mailing List
[SCSI] scsi ioctl: fix kernel-doc warning
Linux Kernel Mailing List
ALSA: HDA - Correct trivial typos in comments.
Linux Kernel Mailing List
i2c-viapro: Add support for SMBus Process Call transactions
Linux Kernel Mailing List
i2c: Documentation: upgrading clients HOWTO
Linux Kernel Mailing List
[PATCH] fix sysctl_nr_open bugs
openbsd-misc
:
Die Gestalt
Re: How to re-build openssl with SHA1 support?
Edwin Eyan Moragas
Re: managing routes for multiple PPPoE connections
Brian Candler
Re: OBSD's perspective on SELinux
Jonathan Schleifer
Why is getaddrinfo breaking POSIX?
Predrag Punosevac
Re: Kernel developers guide/tutorial
Colocation donated by:
Syndicate