* [PATCH 1/10] ide: use pci_dev->revision
@ 2007-08-29 21:16 Bartlomiej Zolnierkiewicz
2007-08-29 21:39 ` Kok, Auke
2007-09-01 16:21 ` Sergei Shtylyov
0 siblings, 2 replies; 6+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-08-29 21:16 UTC (permalink / raw)
To: linux-ide; +Cc: Auke Kok, Greg Kroah-Hartman
Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
they were not converted by commit 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
Quick grep over kernel tree finds out many other places using either
pci_read_config_dword(dev, PCI_CLASS_REVISION, ...) & 0xff or simply
pci_read_config_byte(dev, PCI_CLASS_REVISION, ...) and they all can be
converted to using dev->revision.
Auke, a "PCI_CLASS_REVISION" follow-up to your previous patch would be great.
:)
drivers/ide/pci/pdc202xx_new.c | 6 +-----
drivers/ide/pci/sgiioc4.c | 8 +++-----
drivers/ide/pci/siimage.c | 19 +++++--------------
drivers/ide/setup-pci.c | 6 ++----
4 files changed, 11 insertions(+), 28 deletions(-)
Index: b/drivers/ide/pci/pdc202xx_new.c
===================================================================
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -332,16 +332,12 @@ static long __devinit detect_pll_input_c
static void __devinit apple_kiwi_init(struct pci_dev *pdev)
{
struct device_node *np = pci_device_to_OF_node(pdev);
- unsigned int class_rev = 0;
u8 conf;
if (np == NULL || !of_device_is_compatible(np, "kiwi-root"))
return;
- pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
-
- if (class_rev >= 0x03) {
+ if (pdev->revision >= 0x03) {
/* Setup chip magic config stuff (from darwin) */
pci_read_config_byte (pdev, 0x40, &conf);
pci_write_config_byte(pdev, 0x40, (conf | 0x01));
Index: b/drivers/ide/pci/sgiioc4.c
===================================================================
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -690,14 +690,12 @@ sgiioc4_ide_setup_pci_device(struct pci_
static unsigned int __devinit
pci_init_sgiioc4(struct pci_dev *dev)
{
- unsigned int class_rev;
int ret;
- pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
printk(KERN_INFO "%s: IDE controller at PCI slot %s, revision %d\n",
- DRV_NAME, pci_name(dev), class_rev);
- if (class_rev < IOC4_SUPPORTED_FIRMWARE_REV) {
+ DRV_NAME, pci_name(dev), dev->revision);
+
+ if (dev->revision < IOC4_SUPPORTED_FIRMWARE_REV) {
printk(KERN_ERR "Skipping %s IDE controller in slot %s: "
"firmware is obsolete - please upgrade to "
"revision46 or higher\n",
Index: b/drivers/ide/pci/siimage.c
===================================================================
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -640,13 +640,9 @@ static unsigned int setup_mmio_siimage (
static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
{
- u32 class_rev = 0;
- u8 tmpbyte = 0;
- u8 BA5_EN = 0;
-
- pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
- pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (class_rev) ? 1 : 255);
+ u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0;
+
+ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255);
pci_read_config_byte(dev, 0x8A, &BA5_EN);
if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
@@ -825,19 +821,14 @@ static void __devinit siimage_fixup(ide_
static void __devinit init_iops_siimage(ide_hwif_t *hwif)
{
- struct pci_dev *dev = hwif->pci_dev;
- u32 class_rev = 0;
-
- pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
-
hwif->hwif_data = NULL;
/* Pessimal until we finish probing */
hwif->rqsize = 15;
- if (pci_get_drvdata(dev) == NULL)
+ if (pci_get_drvdata(hwif->pci_dev) == NULL)
return;
+
init_mmio_iops_siimage(hwif);
}
Index: b/drivers/ide/setup-pci.c
===================================================================
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -478,7 +478,6 @@ static void ide_hwif_setup_dma(struct pc
static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config)
{
int ret;
- u32 class_rev;
u16 pcicmd;
if (noisy)
@@ -501,10 +500,9 @@ static int ide_setup_pci_controller(stru
printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
}
- pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
- class_rev &= 0xff;
if (noisy)
- printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
+ printk(KERN_INFO "%s: chipset revision %d\n",
+ d->name, dev->revision);
out:
return ret;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/10] ide: use pci_dev->revision
2007-08-29 21:16 [PATCH 1/10] ide: use pci_dev->revision Bartlomiej Zolnierkiewicz
@ 2007-08-29 21:39 ` Kok, Auke
2007-08-29 22:09 ` Bartlomiej Zolnierkiewicz
2011-02-16 17:52 ` Sergei Shtylyov
2007-09-01 16:21 ` Sergei Shtylyov
1 sibling, 2 replies; 6+ messages in thread
From: Kok, Auke @ 2007-08-29 21:39 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Greg Kroah-Hartman
Bartlomiej Zolnierkiewicz wrote:
> Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
> they were not converted by commit 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
that's actually another effort that I'm working on atm. You can either hold off
on your patch or we'll see how my patches bounce against yours ;)
Cheers,
Auke
>
> Cc: Auke Kok <auke-jan.h.kok@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> Quick grep over kernel tree finds out many other places using either
> pci_read_config_dword(dev, PCI_CLASS_REVISION, ...) & 0xff or simply
> pci_read_config_byte(dev, PCI_CLASS_REVISION, ...) and they all can be
> converted to using dev->revision.
>
> Auke, a "PCI_CLASS_REVISION" follow-up to your previous patch would be great.
> :)
>
> drivers/ide/pci/pdc202xx_new.c | 6 +-----
> drivers/ide/pci/sgiioc4.c | 8 +++-----
> drivers/ide/pci/siimage.c | 19 +++++--------------
> drivers/ide/setup-pci.c | 6 ++----
> 4 files changed, 11 insertions(+), 28 deletions(-)
>
> Index: b/drivers/ide/pci/pdc202xx_new.c
> ===================================================================
> --- a/drivers/ide/pci/pdc202xx_new.c
> +++ b/drivers/ide/pci/pdc202xx_new.c
> @@ -332,16 +332,12 @@ static long __devinit detect_pll_input_c
> static void __devinit apple_kiwi_init(struct pci_dev *pdev)
> {
> struct device_node *np = pci_device_to_OF_node(pdev);
> - unsigned int class_rev = 0;
> u8 conf;
>
> if (np == NULL || !of_device_is_compatible(np, "kiwi-root"))
> return;
>
> - pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
> - class_rev &= 0xff;
> -
> - if (class_rev >= 0x03) {
> + if (pdev->revision >= 0x03) {
> /* Setup chip magic config stuff (from darwin) */
> pci_read_config_byte (pdev, 0x40, &conf);
> pci_write_config_byte(pdev, 0x40, (conf | 0x01));
> Index: b/drivers/ide/pci/sgiioc4.c
> ===================================================================
> --- a/drivers/ide/pci/sgiioc4.c
> +++ b/drivers/ide/pci/sgiioc4.c
> @@ -690,14 +690,12 @@ sgiioc4_ide_setup_pci_device(struct pci_
> static unsigned int __devinit
> pci_init_sgiioc4(struct pci_dev *dev)
> {
> - unsigned int class_rev;
> int ret;
>
> - pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
> - class_rev &= 0xff;
> printk(KERN_INFO "%s: IDE controller at PCI slot %s, revision %d\n",
> - DRV_NAME, pci_name(dev), class_rev);
> - if (class_rev < IOC4_SUPPORTED_FIRMWARE_REV) {
> + DRV_NAME, pci_name(dev), dev->revision);
> +
> + if (dev->revision < IOC4_SUPPORTED_FIRMWARE_REV) {
> printk(KERN_ERR "Skipping %s IDE controller in slot %s: "
> "firmware is obsolete - please upgrade to "
> "revision46 or higher\n",
> Index: b/drivers/ide/pci/siimage.c
> ===================================================================
> --- a/drivers/ide/pci/siimage.c
> +++ b/drivers/ide/pci/siimage.c
> @@ -640,13 +640,9 @@ static unsigned int setup_mmio_siimage (
>
> static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
> {
> - u32 class_rev = 0;
> - u8 tmpbyte = 0;
> - u8 BA5_EN = 0;
> -
> - pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
> - class_rev &= 0xff;
> - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (class_rev) ? 1 : 255);
> + u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0;
> +
> + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255);
>
> pci_read_config_byte(dev, 0x8A, &BA5_EN);
> if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
> @@ -825,19 +821,14 @@ static void __devinit siimage_fixup(ide_
>
> static void __devinit init_iops_siimage(ide_hwif_t *hwif)
> {
> - struct pci_dev *dev = hwif->pci_dev;
> - u32 class_rev = 0;
> -
> - pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
> - class_rev &= 0xff;
> -
> hwif->hwif_data = NULL;
>
> /* Pessimal until we finish probing */
> hwif->rqsize = 15;
>
> - if (pci_get_drvdata(dev) == NULL)
> + if (pci_get_drvdata(hwif->pci_dev) == NULL)
> return;
> +
> init_mmio_iops_siimage(hwif);
> }
>
> Index: b/drivers/ide/setup-pci.c
> ===================================================================
> --- a/drivers/ide/setup-pci.c
> +++ b/drivers/ide/setup-pci.c
> @@ -478,7 +478,6 @@ static void ide_hwif_setup_dma(struct pc
> static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config)
> {
> int ret;
> - u32 class_rev;
> u16 pcicmd;
>
> if (noisy)
> @@ -501,10 +500,9 @@ static int ide_setup_pci_controller(stru
> printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
> }
>
> - pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
> - class_rev &= 0xff;
> if (noisy)
> - printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
> + printk(KERN_INFO "%s: chipset revision %d\n",
> + d->name, dev->revision);
> out:
> return ret;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/10] ide: use pci_dev->revision
2007-08-29 21:39 ` Kok, Auke
@ 2007-08-29 22:09 ` Bartlomiej Zolnierkiewicz
2011-02-16 17:52 ` Sergei Shtylyov
1 sibling, 0 replies; 6+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-08-29 22:09 UTC (permalink / raw)
To: Kok, Auke; +Cc: linux-ide, Greg Kroah-Hartman
On Wednesday 29 August 2007, Kok, Auke wrote:
> Bartlomiej Zolnierkiewicz wrote:
> > Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
> > they were not converted by commit 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
>
>
> that's actually another effort that I'm working on atm. You can either hold off
Great.
> on your patch or we'll see how my patches bounce against yours ;)
I don't envision problems here - my patch is limited to drivers/ide/
and will just get dumped if the more complete patch shows up. :)
Thanks,
Bart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/10] ide: use pci_dev->revision
2007-08-29 21:16 [PATCH 1/10] ide: use pci_dev->revision Bartlomiej Zolnierkiewicz
2007-08-29 21:39 ` Kok, Auke
@ 2007-09-01 16:21 ` Sergei Shtylyov
1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2007-09-01 16:21 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Auke Kok, Greg Kroah-Hartman
Bartlomiej Zolnierkiewicz wrote:
> Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
> they were not converted by commit 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
> ---
> Quick grep over kernel tree finds out many other places using either
> pci_read_config_dword(dev, PCI_CLASS_REVISION, ...) & 0xff or simply
> pci_read_config_byte(dev, PCI_CLASS_REVISION, ...) and they all can be
> converted to using dev->revision.
Nice! I was wondering all the time why the revision ID isn't held with he
device/vendor IDs (wile being a vital detail for many IDE chips ;-).
> Auke, a "PCI_CLASS_REVISION" follow-up to your previous patch would be great.
> :)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/10] ide: use pci_dev->revision
2007-08-29 21:39 ` Kok, Auke
2007-08-29 22:09 ` Bartlomiej Zolnierkiewicz
@ 2011-02-16 17:52 ` Sergei Shtylyov
2011-02-16 19:26 ` Auke Kok
1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-02-16 17:52 UTC (permalink / raw)
To: Kok, Auke; +Cc: Bartlomiej Zolnierkiewicz, linux-ide, Greg Kroah-Hartman
Hello.
Kok, Auke wrote:
>> Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
>> they were not converted by commit
>> 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
> that's actually another effort that I'm working on atm. You can either
> hold off on your patch or we'll see how my patches bounce against yours ;)
What happened to that effort back then I wonder? I'm now dealing with
PCI_CLASS_REVISON piecewise. BTW, there are also new PCI_REVISION_ID users. :-)
> Cheers,
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/10] ide: use pci_dev->revision
2011-02-16 17:52 ` Sergei Shtylyov
@ 2011-02-16 19:26 ` Auke Kok
0 siblings, 0 replies; 6+ messages in thread
From: Auke Kok @ 2011-02-16 19:26 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Bartlomiej Zolnierkiewicz, linux-ide@vger.kernel.org,
Greg Kroah-Hartman
On 02/16/11 09:52, Sergei Shtylyov wrote:
> Hello.
>
> Kok, Auke wrote:
>
>>> Some places were using PCI_CLASS_REVISION instead of PCI_REVISION_ID so
>>> they were not converted by commit
>>> 44c10138fd4bbc4b6d6bff0873c24902f2a9da65.
>
>> that's actually another effort that I'm working on atm. You can either
>> hold off on your patch or we'll see how my patches bounce against yours ;)
>
> What happened to that effort back then I wonder? I'm now dealing with
> PCI_CLASS_REVISON piecewise. BTW, there are also new PCI_REVISION_ID users. :-)
Ha, that was a while ago :)
I've not done any ""real"" driver work for a while now, so feel free to
pick this cleanup off the floor and blow some life in it. I currently do
not have the time to follow up there :)
Auke
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-02-16 19:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 21:16 [PATCH 1/10] ide: use pci_dev->revision Bartlomiej Zolnierkiewicz
2007-08-29 21:39 ` Kok, Auke
2007-08-29 22:09 ` Bartlomiej Zolnierkiewicz
2011-02-16 17:52 ` Sergei Shtylyov
2011-02-16 19:26 ` Auke Kok
2007-09-01 16:21 ` Sergei Shtylyov
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).