Skip to contentSkip to conversation

error returns of pm_runtime_get()

DISCUSSION Oliver Neukum 2 participants 5 messages Sep 5, 2014 – Sep 11, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

looking through multiple drivers it seems to me that a great majority is returning the error returns of pm_runtime_get() to user space. They come quite directly from rpm_resume(). So we are led to return things like -EACCESS or -EINVAL from system calls like open() where they have no place.

So it seems to me like we should filter more or less like this:

-EBUSY -> -EBUSY
-ENOMEM -> -ENOMEM
-EINPROGRES -> -EAGAIN
any other error -> -EIO

And it would be best to retain the current name of pm_runtime_get() and introduce a version with unfiltered error codes. What do you think?

Regards
Oliver

#1 lore raw
Quoted 8 lines · Oliver Neukum

Hi,

looking through multiple drivers it seems to me that a great majority is returning the error returns of pm_runtime_get() to user space. They come quite directly from rpm_resume(). So we are led to return things like -EACCESS or -EINVAL from system calls like open() where they have no place.

Aren't those driver bugs?

Quoted 10 lines

So it seems to me like we should filter more or less like this:

(quoted diff) +0 -3
-EBUSY		-> -EBUSY
-ENOMEM 	-> -ENOMEM
-EINPROGRES	-> -EAGAIN

any other error -> -EIO

And it would be best to retain the current name of pm_runtime_get() and introduce a version with unfiltered error codes. What do you think?

It doesn't sound right to me. I may be tired at the moment, but I'm not sure what the point would be.

Rafael

#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Oliver Neukum

Hi,

looking through multiple drivers it seems to me that a great majority is returning the error returns of pm_runtime_get() to user space. They come quite directly from rpm_resume(). So we are led to return things like -EACCESS or -EINVAL from system calls like open() where they have no place.

Aren't those driver bugs?

Sure, but almost all drivers using runtime PM are affected.

Quoted 7 lines
Quoted 7 lines

So it seems to me like we should filter more or less like this:

(quoted diff) +0 -3
-EBUSY		-> -EBUSY
-ENOMEM 	-> -ENOMEM
-EINPROGRES	-> -EAGAIN

any other error -> -EIO

Quoted 6 lines
Quoted 3 lines

And it would be best to retain the current name of pm_runtime_get() and introduce a version with unfiltered error codes. What do you think?

It doesn't sound right to me. I may be tired at the moment, but I'm not sure what the point would be.

The alternative is to make a conversion helper and to go through all drivers. Not nice, but if necessary I'll do it.
But we cannot just return things like -EACCESS for internal reasons while the file permissions are good.

Regards
Oliver

#3 lore raw
Quoted 11 lines · Oliver Neukum
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Oliver Neukum

Hi,

looking through multiple drivers it seems to me that a great majority is returning the error returns of pm_runtime_get() to user space. They come quite directly from rpm_resume(). So we are led to return things like -EACCESS or -EINVAL from system calls like open() where they have no place.

Quoted 3 lines
Quoted 1 line

Aren't those driver bugs?

Sure, but almost all drivers using runtime PM are affected.

Well, what can I say?

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines

So it seems to me like we should filter more or less like this:

(quoted diff) +0 -3
-EBUSY		-> -EBUSY
-ENOMEM 	-> -ENOMEM
-EINPROGRES	-> -EAGAIN

any other error -> -EIO

Quoted 6 lines
Quoted 3 lines

And it would be best to retain the current name of pm_runtime_get() and introduce a version with unfiltered error codes. What do you think?

It doesn't sound right to me. I may be tired at the moment, but I'm not sure what the point would be.

Quoted 2 lines

The alternative is to make a conversion helper and to go through all drivers. Not nice, but if necessary I'll do it.

I honestly would prefer that.

Quoted 2 lines

But we cannot just return things like -EACCESS for internal reasons while the file permissions are good.

Sure.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#4 lore raw
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines

The alternative is to make a conversion helper and to go through all drivers. Not nice, but if necessary I'll do it.

I honestly would prefer that.

Very well, then I shall do that.

Regards
Oliver