* [PATCH 4/4] radeonfb: use PCI device Id in hex for name string @ 2007-09-04 11:00 aherrman 2007-09-04 13:48 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 3+ messages in thread From: aherrman @ 2007-09-04 11:00 UTC (permalink / raw) To: benh, linux-fbdev-devel, linux-kernel .. instead of potentially using nonprintable characters. I guess the former (odd) concatenation was used to construct name strings that match the "*_ATI_RADEON_??" macros in include/linux/pci_ids.h The PCI Id in hex is much more convenient to use. E.g. it can easily be verified against "lspci -nn" output. Signed-off-by: Andreas Herrmann <aherrman@arcor.de> --- drivers/video/aty/radeon_base.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 71b0c17..e6229b4 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -2184,9 +2184,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, rinfo->lvds_timer.function = radeon_lvds_timer_func; rinfo->lvds_timer.data = (unsigned long)rinfo; - strcpy(rinfo->name, "ATI Radeon XX "); - rinfo->name[11] = ent->device >> 8; - rinfo->name[12] = ent->device & 0xFF; + snprintf(rinfo->name, sizeof(rinfo->name), + "ATI Radeon %x", ent->device & 0xffff); rinfo->family = ent->driver_data & CHIP_FAMILY_MASK; rinfo->chipset = pdev->device; rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0; -- 1.5.3 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/4] radeonfb: use PCI device Id in hex for name string 2007-09-04 11:00 [PATCH 4/4] radeonfb: use PCI device Id in hex for name string aherrman @ 2007-09-04 13:48 ` Benjamin Herrenschmidt 2007-09-10 21:41 ` aherrman 0 siblings, 1 reply; 3+ messages in thread From: Benjamin Herrenschmidt @ 2007-09-04 13:48 UTC (permalink / raw) To: aherrman; +Cc: linux-fbdev-devel, linux-kernel On Tue, 2007-09-04 at 13:00 +0200, aherrman@arcor.de wrote: > .. instead of potentially using nonprintable characters. > > I guess the former (odd) concatenation was used to construct name strings > that match the "*_ATI_RADEON_??" macros in include/linux/pci_ids.h > > The PCI Id in hex is much more convenient to use. E.g. it can easily be > verified against "lspci -nn" output. > > Signed-off-by: Andreas Herrmann <aherrman@arcor.de> Well... ATI used to have printable characters and those were commonly used to identify the cards. I'm not sure we want to unilateraly switch to hex here... Ben. > --- > drivers/video/aty/radeon_base.c | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c > index 71b0c17..e6229b4 100644 > --- a/drivers/video/aty/radeon_base.c > +++ b/drivers/video/aty/radeon_base.c > @@ -2184,9 +2184,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, > rinfo->lvds_timer.function = radeon_lvds_timer_func; > rinfo->lvds_timer.data = (unsigned long)rinfo; > > - strcpy(rinfo->name, "ATI Radeon XX "); > - rinfo->name[11] = ent->device >> 8; > - rinfo->name[12] = ent->device & 0xFF; > + snprintf(rinfo->name, sizeof(rinfo->name), > + "ATI Radeon %x", ent->device & 0xffff); > rinfo->family = ent->driver_data & CHIP_FAMILY_MASK; > rinfo->chipset = pdev->device; > rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/4] radeonfb: use PCI device Id in hex for name string 2007-09-04 13:48 ` Benjamin Herrenschmidt @ 2007-09-10 21:41 ` aherrman 0 siblings, 0 replies; 3+ messages in thread From: aherrman @ 2007-09-10 21:41 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: linux-fbdev-devel, linux-kernel On Tue, Sep 04, 2007 at 03:48:07PM +0200, Benjamin Herrenschmidt wrote: > Well... ATI used to have printable characters and those were commonly > used to identify the cards. I'm not sure we want to unilateraly switch > to hex here... I see. How about the following patch? As an illustration this gives following output for some cards: radeonfb (0000:01:05.0): ATI Radeon 5975 "Yu" radeonfb (0000:02:00.0): ATI Radeon 5b60 "[`" radeonfb (0000:02:00.0): ATI Radeon 5960 "Y`" Regards, Andreas -- radeonfb: use PCI device id in hex for name string Additionally provide PCI device id in character format if possible. (The printable characters were commonly used to identify the cards.) Signed-off-by: Andreas Herrmann <aherrman@arcor.de> --- drivers/video/aty/radeon_base.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index b1bee6f..306d3c7 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -57,6 +57,7 @@ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> +#include <linux/ctype.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/delay.h> @@ -2156,6 +2157,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, struct fb_info *info; struct radeonfb_info *rinfo; int ret; + unsigned char c1, c2; RTRACE("radeonfb_pci_register BEGIN\n"); @@ -2183,9 +2185,15 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, rinfo->lvds_timer.function = radeon_lvds_timer_func; rinfo->lvds_timer.data = (unsigned long)rinfo; - strcpy(rinfo->name, "ATI Radeon XX "); - rinfo->name[11] = ent->device >> 8; - rinfo->name[12] = ent->device & 0xFF; + c1 = ent->device >> 8; + c2 = ent->device & 0xff; + if (isprint(c1) && isprint(c2)) + snprintf(rinfo->name, sizeof(rinfo->name), + "ATI Radeon %x \"%c%c\"", ent->device & 0xffff, c1, c2); + else + snprintf(rinfo->name, sizeof(rinfo->name), + "ATI Radeon %x", ent->device & 0xffff); + rinfo->family = ent->driver_data & CHIP_FAMILY_MASK; rinfo->chipset = pdev->device; rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0; -- 1.5.3 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-10 21:40 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-09-04 11:00 [PATCH 4/4] radeonfb: use PCI device Id in hex for name string aherrman 2007-09-04 13:48 ` Benjamin Herrenschmidt 2007-09-10 21:41 ` aherrman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).