2006-05-30 11:04:46

by Anssi Hannula

[permalink] [raw]
Subject: [patch 12/12] input: use -ENOSPC instead of -ENOMEM in iforce when device full

Use -ENOSPC instead of -ENOMEM when the iforce device doesn't have enough free
memory for the new effect. All other drivers are already been using -ENOSPC,
so this makes the behaviour coherent.

Signed-off-by: Anssi Hannula <[email protected]>

---
drivers/input/joystick/iforce/iforce-ff.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c
===================================================================
--- linux-2.6.17-rc4-git12.orig/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:55:12.000000000 +0300
+++ linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:57:13.000000000 +0300
@@ -47,7 +47,7 @@ static int make_magnitude_modifier(struc
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
- return -ENOMEM;
+ return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
@@ -80,7 +80,7 @@ static int make_period_modifier(struct i
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
- return -ENOMEM;
+ return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
@@ -120,7 +120,7 @@ static int make_envelope_modifier(struct
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
- return -ENOMEM;
+ return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
@@ -157,7 +157,7 @@ static int make_condition_modifier(struc
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
- return -ENOMEM;
+ return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}

--
Anssi Hannula


2006-05-31 04:59:26

by Randy Dunlap

[permalink] [raw]
Subject: Re: [patch 12/12] input: use -ENOSPC instead of -ENOMEM in iforce when device full

On Tue, 30 May 2006 13:57:17 +0300 Anssi Hannula wrote:

> Use -ENOSPC instead of -ENOMEM when the iforce device doesn't have enough free
> memory for the new effect. All other drivers are already been using -ENOSPC,
> so this makes the behaviour coherent.

Could all of the others be wrong?

ENOSPC: No space left on device
ENOMEM: Not enough space [!?!?!?] or Out of memory


> Signed-off-by: Anssi Hannula <[email protected]>
>
> ---
> drivers/input/joystick/iforce/iforce-ff.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> Index: linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c
> ===================================================================
> --- linux-2.6.17-rc4-git12.orig/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:55:12.000000000 +0300
> +++ linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:57:13.000000000 +0300
> @@ -47,7 +47,7 @@ static int make_magnitude_modifier(struc
> iforce->device_memory.start, iforce->device_memory.end, 2L,
> NULL, NULL)) {
> mutex_unlock(&iforce->mem_mutex);
> - return -ENOMEM;
> + return -ENOSPC;
> }
> mutex_unlock(&iforce->mem_mutex);
> }
> @@ -80,7 +80,7 @@ static int make_period_modifier(struct i
> iforce->device_memory.start, iforce->device_memory.end, 2L,
> NULL, NULL)) {
> mutex_unlock(&iforce->mem_mutex);
> - return -ENOMEM;
> + return -ENOSPC;
> }
> mutex_unlock(&iforce->mem_mutex);
> }
> @@ -120,7 +120,7 @@ static int make_envelope_modifier(struct
> iforce->device_memory.start, iforce->device_memory.end, 2L,
> NULL, NULL)) {
> mutex_unlock(&iforce->mem_mutex);
> - return -ENOMEM;
> + return -ENOSPC;
> }
> mutex_unlock(&iforce->mem_mutex);
> }
> @@ -157,7 +157,7 @@ static int make_condition_modifier(struc
> iforce->device_memory.start, iforce->device_memory.end, 2L,
> NULL, NULL)) {
> mutex_unlock(&iforce->mem_mutex);
> - return -ENOMEM;
> + return -ENOSPC;
> }
> mutex_unlock(&iforce->mem_mutex);
> }
>
> --


---
~Randy

2006-05-31 10:04:30

by Anssi Hannula

[permalink] [raw]
Subject: Re: [patch 12/12] input: use -ENOSPC instead of -ENOMEM in iforce when device full

Randy.Dunlap wrote:
> On Tue, 30 May 2006 13:57:17 +0300 Anssi Hannula wrote:
>
>
>>Use -ENOSPC instead of -ENOMEM when the iforce device doesn't have enough free
>>memory for the new effect. All other drivers are already been using -ENOSPC,
>>so this makes the behaviour coherent.
>
>
> Could all of the others be wrong?
>

They could.

> ENOSPC: No space left on device
> ENOMEM: Not enough space [!?!?!?] or Out of memory
>

Hmm, I thought -ENOMEM is "Out of memory" and only to be used when the
system is out of memory, not some internal memory chip in external device.

Does someone have an idea which one should be used?

>
>>Signed-off-by: Anssi Hannula <[email protected]>
>>
>>---
>> drivers/input/joystick/iforce/iforce-ff.c | 8 ++++----
>> 1 files changed, 4 insertions(+), 4 deletions(-)
>>
>>Index: linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c
>>===================================================================
>>--- linux-2.6.17-rc4-git12.orig/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:55:12.000000000 +0300
>>+++ linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:57:13.000000000 +0300
>>@@ -47,7 +47,7 @@ static int make_magnitude_modifier(struc
>> iforce->device_memory.start, iforce->device_memory.end, 2L,
>> NULL, NULL)) {
>> mutex_unlock(&iforce->mem_mutex);
>>- return -ENOMEM;
>>+ return -ENOSPC;
>> }
>> mutex_unlock(&iforce->mem_mutex);
>> }
>>@@ -80,7 +80,7 @@ static int make_period_modifier(struct i
>> iforce->device_memory.start, iforce->device_memory.end, 2L,
>> NULL, NULL)) {
>> mutex_unlock(&iforce->mem_mutex);
>>- return -ENOMEM;
>>+ return -ENOSPC;
>> }
>> mutex_unlock(&iforce->mem_mutex);
>> }
>>@@ -120,7 +120,7 @@ static int make_envelope_modifier(struct
>> iforce->device_memory.start, iforce->device_memory.end, 2L,
>> NULL, NULL)) {
>> mutex_unlock(&iforce->mem_mutex);
>>- return -ENOMEM;
>>+ return -ENOSPC;
>> }
>> mutex_unlock(&iforce->mem_mutex);
>> }
>>@@ -157,7 +157,7 @@ static int make_condition_modifier(struc
>> iforce->device_memory.start, iforce->device_memory.end, 2L,
>> NULL, NULL)) {
>> mutex_unlock(&iforce->mem_mutex);
>>- return -ENOMEM;
>>+ return -ENOSPC;
>> }
>> mutex_unlock(&iforce->mem_mutex);
>> }
>>
>>--
>
>
>
> ---
> ~Randy


--
Anssi Hannula

2006-05-31 15:12:25

by Randy Dunlap

[permalink] [raw]
Subject: Re: [patch 12/12] input: use -ENOSPC instead of -ENOMEM in iforce when device full

On Wed, 31 May 2006 13:04:24 +0300 Anssi Hannula wrote:

> Randy.Dunlap wrote:
> > On Tue, 30 May 2006 13:57:17 +0300 Anssi Hannula wrote:
> >
> >
> >>Use -ENOSPC instead of -ENOMEM when the iforce device doesn't have enough free
> >>memory for the new effect. All other drivers are already been using -ENOSPC,
> >>so this makes the behaviour coherent.
> >
> >
> > Could all of the others be wrong?
> >
>
> They could.
>
> > ENOSPC: No space left on device
> > ENOMEM: Not enough space [!?!?!?] or Out of memory
> >
>
> Hmm, I thought -ENOMEM is "Out of memory" and only to be used when the
> system is out of memory, not some internal memory chip in external device.

Oh, in the case of a device vs. system, I do agree/prefer ENOSPC.
Sorry about my confusion on that.


> Does someone have an idea which one should be used?
>
> >
> >>Signed-off-by: Anssi Hannula <[email protected]>
> >>
> >>---
> >> drivers/input/joystick/iforce/iforce-ff.c | 8 ++++----
> >> 1 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >>Index: linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c
> >>===================================================================
> >>--- linux-2.6.17-rc4-git12.orig/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:55:12.000000000 +0300
> >>+++ linux-2.6.17-rc4-git12/drivers/input/joystick/iforce/iforce-ff.c 2006-05-26 16:57:13.000000000 +0300
> >>@@ -47,7 +47,7 @@ static int make_magnitude_modifier(struc
> >> iforce->device_memory.start, iforce->device_memory.end, 2L,
> >> NULL, NULL)) {
> >> mutex_unlock(&iforce->mem_mutex);
> >>- return -ENOMEM;
> >>+ return -ENOSPC;
> >> }
> >> mutex_unlock(&iforce->mem_mutex);
> >> }
> >>@@ -80,7 +80,7 @@ static int make_period_modifier(struct i
> >> iforce->device_memory.start, iforce->device_memory.end, 2L,
> >> NULL, NULL)) {
> >> mutex_unlock(&iforce->mem_mutex);
> >>- return -ENOMEM;
> >>+ return -ENOSPC;
> >> }
> >> mutex_unlock(&iforce->mem_mutex);
> >> }
> >>@@ -120,7 +120,7 @@ static int make_envelope_modifier(struct
> >> iforce->device_memory.start, iforce->device_memory.end, 2L,
> >> NULL, NULL)) {
> >> mutex_unlock(&iforce->mem_mutex);
> >>- return -ENOMEM;
> >>+ return -ENOSPC;
> >> }
> >> mutex_unlock(&iforce->mem_mutex);
> >> }
> >>@@ -157,7 +157,7 @@ static int make_condition_modifier(struc
> >> iforce->device_memory.start, iforce->device_memory.end, 2L,
> >> NULL, NULL)) {
> >> mutex_unlock(&iforce->mem_mutex);
> >>- return -ENOMEM;
> >>+ return -ENOSPC;
> >> }
> >> mutex_unlock(&iforce->mem_mutex);
> >> }
> >>
> >>--

---
~Randy