Skip to contentSkip to conversation

More PCI patches for 2.6.13

PATCH In review Greg KH 7 participants 12 messages Sep 9, 2005 – Sep 11, 2005

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 More PCI patches for 2.6.13

Here are some more PCI patches against your latest git tree. Most of them were just not applied to the last pci git pull, due to me messing up the mbox that I applied to the tree. They have been in the -mm tree for a while.

The other two patches are a moving around of the pci probe functions so that ppc has an easier time of future work, and I've sent in a pci quirk that has been in the -mm tree for a while.

Please pull from:

	rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/
or if master.kernel.org hasn't synced up yet:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/

The full patches will be sent to the linux-pci mailing lists, if anyone wants to see them.

thanks,

greg k-h

 drivers/pci/hotplug.c               |   53 ++++++++++++++----------------------
 drivers/pci/hotplug/pciehprm_acpi.c |    8 ++---
 drivers/pci/pci.h                   |    1 
 drivers/pci/probe.c                 |   50 ++++++++++++++++++++++-----------
 drivers/pci/quirks.c                |   12 ++++++++
 include/linux/pci.h                 |   23 ++++++++-------
 6 files changed, 83 insertions(+), 64 deletions(-)

Dave Jones:
must_check attributes for PCI layer.

Greg Kroah-Hartman:
PCI: move pci core to use add_hotplug_env_var()

Paul Mackerras:
PCI: Small rearrangement of PCI probing code

Rajesh Shah:
PCI: Fix PCI bus mastering enable problem in pciehp

Rumen Ivanov Zarev:
PCI: Unhide SMBus on Compaq Evo N620c

#1 lore raw
Quoted 3 lines · Greg KH

Dave Jones:
must_check attributes for PCI layer.

Why?

This only clutters up the compile, hiding real errors.

I think all those compile warnings are totally bogus. Who really cares? Are they going to be fixed, or were they added just to irritate people?

We should have a strict rule: anybody who adds things like "must_check" and "deprecated" had better also be ready and willing to fix all the new warnings they cause - you're not allowed to just assume that "somebody else will fix it".

Linus

author
#2 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Dave Jones:
must_check attributes for PCI layer.

Why?

This is something that David and Arjan wanted in. Guys?

Quoted 4 lines

This only clutters up the compile, hiding real errors.

I think all those compile warnings are totally bogus. Who really cares? Are they going to be fixed, or were they added just to irritate people?

I fixed up all of the PCI core and USB drivers that were flagged by these warnings already. Biggest area left is network drivers that I saw.

Quoted 4 lines

We should have a strict rule: anybody who adds things like "must_check" and "deprecated" had better also be ready and willing to fix all the new warnings they cause - you're not allowed to just assume that "somebody else will fix it".

Fair enough. Dave and Arjan, want to fix up the rest of the tree?

thanks,

greg k-h

#3 lore raw
Quoted 4 lines · Greg KH

I fixed up all of the PCI core and USB drivers that were flagged by these warnings already. Biggest area left is network drivers that I saw.

The reason I really dislike patches like these is that it causes people to do questionable things.

For example, there may be perfectly valid reasons why somebody doesn't care about the result. I don't see much point in forcing people to check the return value of "pci_enable_wake()" for example. There's really no real reason to ever care, as far as I can tell - if it fails, there's nothing you can really do about it anyway.

Also, in general, the fact is that things like "pci_set_power_state()" might fail in _theory_, but we just don't care. A driver that doesn't check the return value is in practice as good a driver as one that does, and forcing people to add code that is totally useless in reality - or look at a warning that is irritating - is just not very productive.

There are functions where it is really _important_ to check the error return, because they return errors often enough - and the error case is something you have to do something about - that it's good to force people to be aware.

But "pci_set_power_state()"?

I don't think so.

Linus

#4 lore raw
Quoted 9 lines · Linus Torvalds

There are functions where it is really _important_ to check the error return, because they return errors often enough - and the error case is something you have to do something about - that it's good to force people to be aware.

But "pci_set_power_state()"?

I don't think so.

Btw, a perfect example of this is

	pci_set_power_state(pdev, 0);

which is a very common thing to do in a driver init routine. And it has absolutely _no_ valid return values: it either succeeds, or it doesn't, and the only reason it wouldn't succeed is because the device doesn't support power management in the first place (in which case it already effectively is in state 0).

In other words, there's nothing you can or should do about it. Testing the return value is pointless. And thus adding a "must_check" is really really
wrong: it might make people do

	if (pci_set_power_state(pdev, 0))
		return -ENODEV

which is actually actively the _wrong_ thing to do, and would just cause old revisions of the chip that might not support PM capabilities to no longer work.

The problem with warnings is that people may take them too seriously, and generate bugs when trying to "fix" them.

Linus

#5 lore raw
In reply to Linus Torvalds
Quoted 24 lines · Linus Torvalds
Quoted 4 lines · Greg KH

I fixed up all of the PCI core and USB drivers that were flagged by these warnings already. Biggest area left is network drivers that I saw.

The reason I really dislike patches like these is that it causes people to do questionable things.

For example, there may be perfectly valid reasons why somebody doesn't care about the result. I don't see much point in forcing people to check the return value of "pci_enable_wake()" for example. There's really no real reason to ever care, as far as I can tell - if it fails, there's nothing you can really do about it anyway.

Also, in general, the fact is that things like "pci_set_power_state()" might fail in _theory_, but we just don't care. A driver that doesn't check the return value is in practice as good a driver as one that does, and forcing people to add code that is totally useless in reality - or look at a warning that is irritating - is just not very productive.

Quoted 9 lines

There are functions where it is really _important_ to check the error return, because they return errors often enough - and the error case is something you have to do something about - that it's good to force people to be aware.

But "pci_set_power_state()"?

I don't think so.

If something like a PCI power management function fails then it will likely cause suspend or resume to malfunction, and we have a lot of such problems.

So we-the-developers do need to hear about it when such functions fail. So either a) each and every driver has to blurt a printk (dumb) or b) we stick a warning and a backtrace in the failing function (better).

#6 lore raw
Quoted 3 lines · Andrew Morton

If something like a PCI power management function fails then it will likely cause suspend or resume to malfunction, and we have a lot of such problems.

No, for several reasons.

First off, some of those functions can't fail in normal usage. Thus telling people that they have to check the return code is insane.

Secondly, at least some of the suspend failures have historically been because drivers returned errors for no good reason. Adding yet another broken reason to return error is not going to help.

Linus

#7 lore raw
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Andrew Morton

If something like a PCI power management function fails then it will likely cause suspend or resume to malfunction, and we have a lot of such problems.

Quoted 6 lines

No, for several reasons.

First off, some of those functions can't fail in normal usage. Thus telling people that they have to check the return code is insane.

Secondly, at least some of the suspend failures have historically been
because drivers returned errors for no good reason. Adding yet another broken reason to return error is not going to help.

Agreed.

Jeff

#8 lore raw
In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds

the return value of "pci_enable_wake()" for example. There's really no real reason to ever care, as far as I can tell - if it fails, there's nothing you can really do about it anyway.

Also, in general, the fact is that things like "pci_set_power_state()" might fail in _theory_, but we just don't care. A driver that doesn't

But, aren't these arguments for changing the functions to return void? If there is never any point in checking the results, then why have results at all?

John

Signature · 2 lines
John W. Linville
[email protected]
#9 lore raw
Quoted 4 lines · John W. Linville

But, aren't these arguments for changing the functions to return void? If there is never any point in checking the results, then why have results at all?

Trying to set other power states than D0 might return interesting values. Also, you _can_ use the value to determine whether the device supports PM states at all.

There are tons of functions that return values. That doesn't mean that you always have to check them.

Linus

#10 lore raw

Hi!

Quoted 7 lines
Quoted 3 lines

But, aren't these arguments for changing the functions to return void? If there is never any point in checking the results, then why have results at all?

Trying to set other power states than D0 might return interesting values. Also, you _can_ use the value to determine whether the device supports PM states at all.

Perhaps we should make pci_set_power_state(pdev, PCI_D0) to succeed in case of old device not supporting power managment? As you've said, it is effectively in PCI_D0 anyway ;-).
Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#11 lore raw
In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Dave Jones:
must_check attributes for PCI layer.

Why?

This is something that David and Arjan wanted in. Guys?

The one I cared about is pci_enable_device(); the others I care about a lot less to not at all.