staging: axis-fifo: initialize timeouts in init only
PATCH v8 1/1 staging: axis-fifo: initialize timeouts in init only
Initialize the module parameters, read_timeout and write_timeout once in init().
Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to wait_event_interruptible_timeout().
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout = MAX_SCHEDULE_TIMEOUT' results in an overflow.
Change format specifier for {read,write}_timeout from %i to %li.
---
Changes in v8:
- Fixed a spelling mistake
Changes in v7:
- Fixed a grammatical error
Changes in v6:
- Initialize module parameters in init instead of probe function.
- Change the subject and description
- Change format specifiers of module parameters to "%li"
Changes in v5:
- Convert module parameters datatype from int to long.
- Link to patch:
https://lore.kernel.org/outreachy/ZBMR4s8xyHGqMm72@khadija-virtual-machine/
Changes in v4:
- Initialize timeouts once as suggested by Greg; this automatically fixes the indentation problems.
- Change the subject and description.
- Link to patch:
https://lore.kernel.org/outreachy/ZA4M3+ZeB1Rl2fbs@khadija-virtual-machine/
Changes in v3:
- Correct grammatical mistakes
- Do not change the second argument's indentation in split lines
Changes in v2:
- Instead of matching alignment to open parenthesis, align second and the last argument.
- Change the subject and use imperative language.
- Link to patch:
https://lore.kernel.org/outreachy/ZAxNYw2rFQkrdtKl@khadija-virtual-machine/
Link to first patch:
https://lore.kernel.org/outreachy/ZAZSmPpB6fcozGa4@khadija-virtual-machine/
drivers/staging/axis-fifo/axis-fifo.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +17 -11
@@ -103,17 +103,17 @@* globals * ---------------------------- */ -static int read_timeout =1000 ;/* ms to wait before read() times out */ -static int write_timeout =1000 ;/* ms to wait before write() times out */ +static long read_timeout =1000 ;/* ms to wait before read() times out */ +static long write_timeout =1000 ;/* ms to wait before write() times out */ /* ---------------------------- * module command-line arguments * ---------------------------- */ -module_param (read_timeout, int,0444 ); +module_param (read_timeout, long,0444 );MODULE_PARM_DESC (read_timeout,"ms to wait before blocking read() timing out; set to -1 for no timeout" ); -module_param (write_timeout, int,0444 ); +module_param (write_timeout, long,0444 );MODULE_PARM_DESC (write_timeout,"ms to wait before blocking write() timing out; set to -1 for no timeout" );/* ----------------------------
@@ -384,9 +384,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,mutex_lock (&fifo->read_lock); ret =wait_event_interruptible_timeout (fifo->read_queue,ioread32 (fifo->base_addr +XLLF_RDFO_OFFSET ), - (read_timeout >=0 ) ? -msecs_to_jiffies (read_timeout) : -MAX_SCHEDULE_TIMEOUT ); + read_timeout);if (ret <=0 ) {if (ret ==0 ) {
@@ -528,9 +526,7 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, ret =wait_event_interruptible_timeout (fifo->write_queue,ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write, - (write_timeout >=0 ) ? -msecs_to_jiffies (write_timeout) : -MAX_SCHEDULE_TIMEOUT ); + write_timeout);if (ret <=0 ) {if (ret ==0 ) {
@@ -948,7 +944,17 @@ static struct platform_driver axis_fifo_driver = {static int __init axis_fifo_init (void ) { -pr_info ("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n" , +if (read_timeout >=0 ) + read_timeout =msecs_to_jiffies (read_timeout); +else + read_timeout =MAX_SCHEDULE_TIMEOUT ; + +if (write_timeout >=0 ) + write_timeout =msecs_to_jiffies (write_timeout); +else + write_timeout =MAX_SCHEDULE_TIMEOUT ; + +pr_info ("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n" , read_timeout, write_timeout);return platform_driver_register (&axis_fifo_driver); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerQuoted 6 lines · Khadija Kamran
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().
I feel like we are being too picky here, but this isn't the correct wording. It is possible for module parameters to be modified "later", if the permissions on the parameter are set to allow this. But that's not what this driver does here, so this might be better phrased as:
The module parameters in this driver can not be modified after loading, so they can be evaluated once at module load and set to default values if needed at that time.
Quoted 5 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
You are listing all of _what_ you do here, not really _why_ you are doing any of this.
Anyway, if I were writing this, here's what I would say as a changelog text:
The module parameters, read_timeout and write_timeout, are only ever evaluated at module load time, so set the default values then if needed so as to not recompute the timeout values every time the driver reads or writes data.
And that's it, short, concise, and it explains why you are doing this.
Writing changelog comments are almost always harder than actually writing the patch (at least for me.) So don't feel bad, it take a lot of experience doing it.
All that being said, I think we are just polishing something that doesn't need to really be polished anymore, so let me go just apply this patch as-is to the tree now so you can move on to a different change. You've put in the effort here, and I don't want you to get bogged down in specifics that really do not matter at all overall (like the memory size of your vm...)
thanks,
greg k-h
Quoted 35 lines · On venerdì 17 marzo 2023 08:13:37 CET Greg Kroah-Hartman wrote:
Quoted 6 lines · Khadija Kamran
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().I feel like we are being too picky here, but this isn't the correct wording. It is possible for module parameters to be modified "later", if the permissions on the parameter are set to allow this. But that's not what this driver does here, so this might be better phrased as:
The module parameters in this driver can not be modified after loading, so they can be evaluated once at module load and set to default values if needed at that time.
Quoted 5 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
You are listing all of _what_ you do here, not really _why_ you are doing any of this.
Anyway, if I were writing this, here's what I would say as a changelog text:
The module parameters,
read_timeoutandwrite_timeout, are only ever evaluated at module load time, so set the default values then if needed so as to not recompute the timeout values every time the driver reads or writes data.
Quoted 5 lines
And that's it, short, concise, and it explains why you are doing this.
Writing changelog comments are almost always harder than actually writing the patch (at least for me.) So don't feel bad, it take a lot of experience doing it.
Thanks for helping Khadija (and also me, indirectly, because I helped them to make that commit message). After a little less than 200 commits already upstream, there is still to learn how to make a good changelog (which I think it's not less important than the code in the patch).
Quoted 4 lines
All that being said, I think we are just polishing something that doesn't need to really be polished anymore,
so let me go just apply this
patch as-is to the tree now so you can move on to a different change.
Yes, thanks. It's time to move on.
Quoted 3 lines
You've put in the effort here, and I don't want you to get bogged down in specifics that really do not matter at all overall (like the memory size of your vm...)
You probably didn't pay attention to the problems Khadija has being experiencing with memory exhaustion and compilation times.
First time they complained had several crashes while building and messages saying there was not enough available memory. Then several other problems with builds' time. Finally, yesterday they wrote that "make modules_install install" took "hours" (literally).
This is why I think they should also be helped with their VM configuration (despite it was unrelated to the patch). They won't be able to work on some projects if they cannot do quick builds and run hundreds of tests in no time (e.g., I'm especially talking about Ira's and my project about the conversions from kmap{,_atomic}() to kmap_local_page()).
I understand that this is only noise for you, as a maintainer. However I'm pretty sure that they need help with speeding up builds and installation. The projects cannot wait "hours" just for install of modules and kernel images.
Again thanks for your precious suggestions about how to improve commit messages.
Fabio
Quoted 3 lines
thanks,
greg k-h
Quoted 38 lines · Fabio M. De Francesco
Quoted 37 lines · On venerdì 17 marzo 2023 08:13:37 CET Greg Kroah-Hartman wrote:
Quoted 6 lines · Khadija Kamran
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().I feel like we are being too picky here, but this isn't the correct wording. It is possible for module parameters to be modified "later", if the permissions on the parameter are set to allow this. But that's not what this driver does here, so this might be better phrased as:
The module parameters in this driver can not be modified after loading, so they can be evaluated once at module load and set to default values if needed at that time.
Quoted 5 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
You are listing all of _what_ you do here, not really _why_ you are doing any of this.
Anyway, if I were writing this, here's what I would say as a changelog text:
The module parameters,
read_timeoutandwrite_timeout, are only ever evaluated at module load time, so set the default values then if needed so as to not recompute the timeout values every time the driver reads or writes data.And that's it, short, concise, and it explains why you are doing this.
Quoted 9 lines
Quoted 3 lines
Writing changelog comments are almost always harder than actually writing the patch (at least for me.) So don't feel bad, it take a lot of experience doing it.
Thanks for helping Khadija (and also me, indirectly, because I helped them to make that commit message). After a little less than 200 commits already upstream, there is still to learn how to make a good changelog (which I think it's not less important than the code in the patch).
Hey Fabio!
I am glad to be a part of this process. Thank you for all the help with the commit messages. :)
Quoted 7 lines
Quoted 4 lines
All that being said, I think we are just polishing something that doesn't need to really be polished anymore,
so let me go just apply this
patch as-is to the tree now so you can move on to a different change.Yes, thanks. It's time to move on.
yes, please.
Quoted 12 lines
Quoted 3 lines
You've put in the effort here, and I don't want you to get bogged down in specifics that really do not matter at all overall (like the memory size of your vm...)
You probably didn't pay attention to the problems Khadija has being experiencing with memory exhaustion and compilation times.
First time they complained had several crashes while building and messages saying there was not enough available memory. Then several other problems with builds' time. Finally, yesterday they wrote that "make
modules_installinstall" took "hours" (literally).
Quoted 6 lines
This is why I think they should also be helped with their VM configuration (despite it was unrelated to the patch). They won't be able to work on some projects if they cannot do quick builds and run hundreds of tests in no time (e.g., I'm especially talking about Ira's and my project about the conversions from kmap{,_atomic}() to
kmap_local_page()).
Thank you Fabio!
I am waiting for your message on #kernel-outreachy.
Regards,
Khadija
Quoted 16 lines
I understand that this is only noise for you, as a maintainer. However I'm pretty sure that they need help with speeding up builds and installation. The projects cannot wait "hours" just for install of modules and kernel images.
Again thanks for your precious suggestions about how to improve commit messages.
Fabio
Quoted 3 lines
thanks,
greg k-h
Quoted 41 lines · Greg Kroah-Hartman
Quoted 6 lines · Khadija Kamran
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().I feel like we are being too picky here, but this isn't the correct wording. It is possible for module parameters to be modified "later", if the permissions on the parameter are set to allow this. But that's not what this driver does here, so this might be better phrased as:
The module parameters in this driver can not be modified after loading, so they can be evaluated once at module load and set to default values if needed at that time.
Quoted 5 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
You are listing all of _what_ you do here, not really _why_ you are doing any of this.
Anyway, if I were writing this, here's what I would say as a changelog text:
The module parameters,
read_timeoutandwrite_timeout, are only ever evaluated at module load time, so set the default values then if needed so as to not recompute the timeout values every time the driver reads or writes data.And that's it, short, concise, and it explains why you are doing this.
Writing changelog comments are almost always harder than actually writing the patch (at least for me.) So don't feel bad, it take a lot of experience doing it.
Quoted 7 lines
All that being said, I think we are just polishing something that doesn't need to really be polished anymore, so let me go just apply this patch as-is to the tree now so you can move on to a different change. You've put in the effort here, and I don't want you to get bogged down in specifics that really do not matter at all overall (like the memory size of your vm...)
Okay Great! Thank you Greg!
Regards,
Khadija
Quoted 3 lines
thanks,
greg k-h
Khadija,
Congratulations for having your first patch in Linux, via Greg's staging tree.
It will take some time before it reaches mainline, although it is already on its way to get upstream.
Quoted 6 lines · On giovedì 16 marzo 2023 21:09:00 CET Khadija Kamran wrote:
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().
Greg made you (and indirectly me notice) that the statement above is a kind of short-circuit because it misses to make the readers notice that you are dealing with specific permissions granted to these two module's parameters.
Please take a look at the permissions associated with those parameters:
module_param(write_timeout, long, 0444);module_param(read_timeout, long, 0444);
Can you understand what '0444' stands for? What if their permissions were instead something like '0666' or '0664'?
(I'm not asking you to answer these questions, instead I am only asking you to learn how it works if you don't know it yet).
Fabio
Quoted 63 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
Reviewed-by Fabio M. De Francesco <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Khadija Kamran <[email protected]>---
Changes in v8:
- Fixed a spelling mistakeChanges in v7:
- Fixed a grammatical errorChanges in v6:
- Initialize module parameters in init instead of probe function.
- Change the subject and description
- Change format specifiers of module parameters to "%li"Changes in v5:
- Convert module parameters datatype from int to long.
- Link to patch:
https://lore.kernel.org/outreachy/ZBMR4s8xyHGqMm72@khadija-virtual-machine/Changes in v4:
- Initialize timeouts once as suggested by Greg; this automatically fixes the indentation problems.
- Change the subject and description.
- Link to patch:
https://lore.kernel.org/outreachy/ZA4M3+ZeB1Rl2fbs@khadija-virtual-machine/Changes in v3:
- Correct grammatical mistakes
- Do not change the second argument's indentation in split linesChanges in v2:
- Instead of matching alignment to open parenthesis, align second and the last argument.
- Change the subject and use imperative language.
- Link to patch:
https://lore.kernel.org/outreachy/ZAxNYw2rFQkrdtKl@khadija-virtual-machine/Link to first patch:
https://lore.kernel.org/outreachy/ZAZSmPpB6fcozGa4@khadija-virtual-machine/drivers/staging/axis-fifo/axis-fifo.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)(quoted diff) +0
-0
b/drivers/staging/axis-fifo/axis-fifo.cindexdfd2b357f484..0a85ea667a1b100644drivers/staging/axis-fifo/axis-fifo.c +1
-2@@ -103,17 +103,17 @@* globals * ---------------------------- */ -static int read_timeout =1000 ;/* ms to wait before read() times out */ -static int write_timeout =1000 ;/* ms to wait before write() times out */ +static long read_timeout =1000 ;/* ms to wait before read() times out */
drivers/staging/axis-fifo/axis-fifo.c line 115
Quoted 10 lines
drivers/staging/axis-fifo/axis-fifo.c +2
-1+static long write_timeout =1000 ;/* ms to wait before write() times out */ /* ---------------------------- * module command-line arguments * ---------------------------- */ -module_param (read_timeout, int,0444 ); +module_param (read_timeout, long,0444 ); MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing
out;
drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_read(struct file *f, char
Quoted 7 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-0set to -1 for no timeout"); -module_param(write_timeout, int, 0444); +module_param(write_timeout, long,0444 );MODULE_PARM_DESC (write_timeout,"ms to wait before blocking write() timing out; set to -1 for no timeout");/* ---------------------------- @@ -384,9 +384,7 @@ static ssize_t axis_fifo_read(struct file *f, char
__user
drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const
Quoted 11 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-3*buf,mutex_lock (&fifo->read_lock); ret =wait_event_interruptible_timeout (fifo->read_queue,ioread32 (fifo->base_addr +XLLF_RDFO_OFFSET ), - (read_timeout >=0 ) ? -msecs_to_jiffies (read_timeout) : -MAX_SCHEDULE_TIMEOUT ); + read_timeout);if (ret <=0 ) {if (ret ==0 ) {@@ -528,9 +526,7 @@ static ssize_t axis_fifo_write(struct file *f, const
char
Quoted 33 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-3__user *buf, ret =wait_event_interruptible_timeout (fifo->write_queue,ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write, - (write_timeout >=0 ) ? -msecs_to_jiffies (write_timeout) : -MAX_SCHEDULE_TIMEOUT ); + write_timeout);drivers/staging/axis-fifo/axis-fifo.c +10
-2if (ret <=0 ) {if (ret ==0 ) {@@ -948,7 +944,17 @@ static struct platform_driver axis_fifo_driver = {static int __init axis_fifo_init (void ) { -pr_info ("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n", + if (read_timeout >= 0) + read_timeout = msecs_to_jiffies(read_timeout); + else + read_timeout =MAX_SCHEDULE_TIMEOUT ; + +if (write_timeout >=0 ) + write_timeout =msecs_to_jiffies (write_timeout); +else + write_timeout =MAX_SCHEDULE_TIMEOUT ; + +pr_info ("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n", read_timeout, write_timeout);return platform_driver_register (&axis_fifo_driver); } --2.34.1
Quoted 6 lines · Fabio M. De Francesco
Khadija,
Congratulations for having your first patch in Linux, via Greg's staging tree.
It will take some time before it reaches mainline, although it is already on its way to get upstream.
Thank you! :)
Quoted 13 lines · On giovedì 16 marzo 2023 21:09:00 CET Khadija Kamran wrote:
Quoted 6 lines
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().Greg made you (and indirectly me notice) that the statement above is a kind of short-circuit because it misses to make the readers notice that you are dealing with specific permissions granted to these two module's parameters.
Quoted 8 lines
Please take a look at the permissions associated with those parameters:
module_param(write_timeout, long, 0444);module_param(read_timeout, long, 0444);Can you understand what '0444' stands for? What if their permissions were instead something like '0666' or '0664'?
Hey Fabio!
I understand that 0444 shows read permissions only.
I am trying to make sense of this. As the permissions do not allow write, so the value cannot be configured afterwards.
Instead of saying 'cannot be modified later', we should talk more about permissions here too.
Am I getting it right?
Thank you!
Regards,
Khadija
Quoted 136 lines
(I'm not asking you to answer these questions, instead I am only asking you to learn how it works if you don't know it yet).
Fabio
Quoted 63 lines
Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout =
MAX_SCHEDULE_TIMEOUT' results in an overflow.Change format specifier for {read,write}_timeout from %i to %li.
Reviewed-by Fabio M. De Francesco <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Khadija Kamran <[email protected]>---
Changes in v8:
- Fixed a spelling mistakeChanges in v7:
- Fixed a grammatical errorChanges in v6:
- Initialize module parameters in init instead of probe function.
- Change the subject and description
- Change format specifiers of module parameters to "%li"Changes in v5:
- Convert module parameters datatype from int to long.
- Link to patch:
https://lore.kernel.org/outreachy/ZBMR4s8xyHGqMm72@khadija-virtual-machine/Changes in v4:
- Initialize timeouts once as suggested by Greg; this automatically fixes the indentation problems.
- Change the subject and description.
- Link to patch:
https://lore.kernel.org/outreachy/ZA4M3+ZeB1Rl2fbs@khadija-virtual-machine/Changes in v3:
- Correct grammatical mistakes
- Do not change the second argument's indentation in split linesChanges in v2:
- Instead of matching alignment to open parenthesis, align second and the last argument.
- Change the subject and use imperative language.
- Link to patch:
https://lore.kernel.org/outreachy/ZAxNYw2rFQkrdtKl@khadija-virtual-machine/Link to first patch:
https://lore.kernel.org/outreachy/ZAZSmPpB6fcozGa4@khadija-virtual-machine/drivers/staging/axis-fifo/axis-fifo.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)(quoted diff) +0
-0
b/drivers/staging/axis-fifo/axis-fifo.cindexdfd2b357f484..0a85ea667a1b100644drivers/staging/axis-fifo/axis-fifo.c +1
-2@@ -103,17 +103,17 @@* globals * ---------------------------- */ -static int read_timeout =1000 ;/* ms to wait before read() times out */ -static int write_timeout =1000 ;/* ms to wait before write() times out */ +static long read_timeout =1000 ;/* ms to wait before read() times out */ drivers/staging/axis-fifo/axis-fifo.c line 115
Quoted 10 lines
drivers/staging/axis-fifo/axis-fifo.c +2
-1+static long write_timeout =1000 ;/* ms to wait before write() times out */ /* ---------------------------- * module command-line arguments * ---------------------------- */ -module_param (read_timeout, int,0444 ); +module_param (read_timeout, long,0444 ); MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timingout;
drivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_read(struct file *f, char
Quoted 7 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-0set to -1 for no timeout"); -module_param(write_timeout, int, 0444); +module_param(write_timeout, long,0444 );MODULE_PARM_DESC (write_timeout,"ms to wait before blocking write() timing out; set to -1 for no timeout");/* ---------------------------- @@ -384,9 +384,7 @@ static ssize_t axis_fifo_read(struct file *f, char
__userdrivers/staging/axis-fifo/axis-fifo.c static ssize_t axis_fifo_write(struct file *f, const
Quoted 11 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-3*buf,mutex_lock (&fifo->read_lock); ret =wait_event_interruptible_timeout (fifo->read_queue,ioread32 (fifo->base_addr +XLLF_RDFO_OFFSET ), - (read_timeout >=0 ) ? -msecs_to_jiffies (read_timeout) : -MAX_SCHEDULE_TIMEOUT ); + read_timeout);if (ret <=0 ) {if (ret ==0 ) {@@ -528,9 +526,7 @@ static ssize_t axis_fifo_write(struct file *f, constchar
Quoted 33 lines
drivers/staging/axis-fifo/axis-fifo.c +1
-3__user *buf, ret =wait_event_interruptible_timeout (fifo->write_queue,ioread32 (fifo->base_addr +XLLF_TDFV_OFFSET ) >= words_to_write, - (write_timeout >=0 ) ? -msecs_to_jiffies (write_timeout) : -MAX_SCHEDULE_TIMEOUT ); + write_timeout);drivers/staging/axis-fifo/axis-fifo.c +10
-2if (ret <=0 ) {if (ret ==0 ) {@@ -948,7 +944,17 @@ static struct platform_driver axis_fifo_driver = {static int __init axis_fifo_init (void ) { -pr_info ("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n", + if (read_timeout >= 0) + read_timeout = msecs_to_jiffies(read_timeout); + else + read_timeout =MAX_SCHEDULE_TIMEOUT ; + +if (write_timeout >=0 ) + write_timeout =msecs_to_jiffies (write_timeout); +else + write_timeout =MAX_SCHEDULE_TIMEOUT ; + +pr_info ("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n", read_timeout, write_timeout);return platform_driver_register (&axis_fifo_driver); } --2.34.1
Quoted 7 lines · On lunedì 20 marzo 2023 07:34:04 CET Khadija Kamran wrote:
Quoted 6 lines · Fabio M. De Francesco
Khadija,
Congratulations for having your first patch in Linux, via Greg's staging tree.
It will take some time before it reaches mainline, although it is already
on
Quoted 9 lines
Quoted 1 line
its way to get upstream.
Thank you! :)
Quoted 5 lines · On giovedì 16 marzo 2023 21:09:00 CET Khadija Kamran wrote:
Quoted 4 lines
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so
we
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().Greg made you (and indirectly me notice) that the statement above is a
kind
Quoted 2 lines
Quoted 2 lines
of short-circuit because it misses to make the readers notice that you are dealing with specific permissions granted to these two module's
parameters.
Quoted 6 lines
Quoted 6 lines
Please take a look at the permissions associated with those parameters:
module_param(write_timeout, long, 0444);module_param(read_timeout, long, 0444);
Quoted 6 lines
Quoted 2 lines
Can you understand what '0444' stands for? What if their permissions were instead something like '0666' or '0664'?
Hey Fabio!
I understand that 0444 shows read permissions only.
Yes, correct.
Only "read" permissions for owner, group, others.
Obviously, when the module is initialized, "insmod" can pass actual values to the arguments. The point is that from that moment onward nobody is allowed to change the initial values associated with this variables, but they can still be read at will.
Quoted 2 lines
I am trying to make sense of this. As the permissions do not allow write, so the value cannot be configured afterwards.
Yes, if with "afterwards" you are intending after they are set at insmod runs.
Quoted 2 lines
Instead of saying 'cannot be modified later', we should talk more about permissions here too.
I'm confused by this statement. Can you please rephrase?
Quoted 1 line
Am I getting it right?
Not sure, it depends on what you meant with the previous phrase.
Quoted 4 lines
Thank you!
Regards,
Khadija
You're welcome!
So, thanks for working on this patch as long as it takes to get it done.
I think the lesson to be learned is that in our community there are barriers to the entry of substandard products and therefore people have to do their best if they really want to see their work applied.
These tasks are not for the "faints of heart" :-)
Fabio
Quoted 11 lines · Fabio M. De Francesco
Quoted 7 lines · On lunedì 20 marzo 2023 07:34:04 CET Khadija Kamran wrote:
Quoted 6 lines · Fabio M. De Francesco
Khadija,
Congratulations for having your first patch in Linux, via Greg's staging tree.
It will take some time before it reaches mainline, although it is already
on
Quoted 2 lines
Quoted 1 line
its way to get upstream.
Quoted 11 lines
Quoted 7 lines
Thank you! :)
Quoted 5 lines · On giovedì 16 marzo 2023 21:09:00 CET Khadija Kamran wrote:
Quoted 4 lines
Initialize the module parameters,
read_timeoutandwrite_timeoutonce ininit().Module parameters can only be set once and cannot be modified later, so
we
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
don't need to evaluate them again when passing the parameters to
wait_event_interruptible_timeout().
Hey Fabio,
I am talking about this below:
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Greg made you (and indirectly me notice) that the statement above is a
kind
Quoted 2 lines
Quoted 2 lines
of short-circuit because it misses to make the readers notice that you are dealing with specific permissions granted to these two module's
parameters.
Only "read" permissions for owner, group, others.
Obviously, when the module is initialized, "insmod" can pass actual values to the arguments. The point is that from that moment onward nobody is allowed to change the initial values associated with this variables, but they can still be read at will.Quoted 2 lines
I am trying to make sense of this. As the permissions do not allow write, so the value cannot be configured afterwards.
Yes, if with "afterwards" you are intending after they are set at insmod runs.
Quoted 8 lines
Quoted 2 lines
Instead of saying 'cannot be modified later', we should talk more about permissions here too.
I'm confused by this statement. Can you please rephrase?
Quoted 1 line
Am I getting it right?
Not sure, it depends on what you meant with the previous phrase.
As you said above that the commit message makes the reader miss the permission details, so should we write more about permissions in the description?
Quoted 6 lines
Quoted 5 lines
Thank you!
Regards,
Khadija
Quoted 7 lines
You're welcome!
So, thanks for working on this patch as long as it takes to get it done.
I think the lesson to be learned is that in our community there are barriers to the entry of substandard products and therefore people have to do their best if they really want to see their work applied.
Yes, you are right. Due to this reason, the whole process is making me learn a lot. I am really glad to be a part of it ^-^
Quoted 4 lines
These tasks are not for the "faints of heart" :-)
Fabio
Regards,
Khadija :)
Quoted 2 lines
Quoted 6 lines · On lunedì 20 marzo 2023 15:36:03 CET Khadija Kamran wrote:
Quoted 5 lines · Fabio M. De Francesco
Quoted 4 lines · On lunedì 20 marzo 2023 07:34:04 CET Khadija Kamran wrote:
Quoted 3 lines · Fabio M. De Francesco
Khadija,
Congratulations for having your first patch in Linux, via Greg's
staging
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
tree.
It will take some time before it reaches mainline, although it is already on its way to get upstream.
[snip]
I'm confused by this statement. Can you please rephrase?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Am I getting it right?
Not sure, it depends on what you meant with the previous phrase.
As you said above that the commit message makes the reader miss the permission details, so should we write more about permissions in the description?
No. Greg took your patch as is.
No new versions for patches that Maintainers (i.e., Greg Kroah-Hartman for drivers/staging and several other subsystems and drivers) already applied.
We've been discussing this topic after Greg had already taken your patch only for the purpose to clarify to you why he suggested a better commit message. However, he suggested that better message while stating that he prefers to take your patch as is to give you time to work on something new.
I suppose that you received the two automated messages, the first which communicates that your patch has been applied to his staging-test tree and the second which says that it has moved forward to the next step, which is the staging-next tree. I saw those messages in Cc because I put my "Reviewed-by" tag to your patch, so I know you had them.
Fabio
P.S.: Today I sent you an off-list message. Please locate it and reply.
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Thank you!
Regards,
KhadijaYou're welcome!
So, thanks for working on this patch as long as it takes to get it done.
I think the lesson to be learned is that in our community there are
barriers
Quoted 12 lines
Quoted 2 lines
to the entry of substandard products and therefore people have to do their best if they really want to see their work applied.
Yes, you are right. Due to this reason, the whole process is making me learn a lot. I am really glad to be a part of it ^-^
Quoted 3 lines
These tasks are not for the "faints of heart" :-)
Fabio
Regards,
Khadija :)
Quoted 25 lines · Fabio M. De Francesco
Quoted 6 lines · On lunedì 20 marzo 2023 15:36:03 CET Khadija Kamran wrote:
Quoted 5 lines · Fabio M. De Francesco
Quoted 4 lines · On lunedì 20 marzo 2023 07:34:04 CET Khadija Kamran wrote:
Quoted 3 lines · Fabio M. De Francesco
Khadija,
Congratulations for having your first patch in Linux, via Greg's
staging
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
tree.
It will take some time before it reaches mainline, although it is already on its way to get upstream.
[snip]
I'm confused by this statement. Can you please rephrase?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Am I getting it right?
Not sure, it depends on what you meant with the previous phrase.
As you said above that the commit message makes the reader miss the permission details, so should we write more about permissions in the description?
Quoted 9 lines
No. Greg took your patch as is.
No new versions for patches that Maintainers (i.e., Greg Kroah-Hartman fordrivers/stagingand several other subsystems and drivers) already applied.We've been discussing this topic after Greg had already taken your patch only for the purpose to clarify to you why he suggested a better commit message. However, he suggested that better message while stating that he prefers to take your patch as is to give you time to work on something new.
Hey Fabio!
Okay understood.
Quoted 6 lines
I suppose that you received the two automated messages, the first which communicates that your patch has been applied to his staging-test tree and the second which says that it has moved forward to the next step, which is the staging-next tree. I saw those messages in Cc because I put my "Reviewed-by" tag to your patch, so I know you had them.
Yes, I did receive the messages.
Quoted 4 lines
Fabio
P.S.: Today I sent you an off-list message. Please locate it and reply.
Okay Thank you for your help.
Regards,
Khadija
Quoted 27 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Thank you!
Regards,
KhadijaYou're welcome!
So, thanks for working on this patch as long as it takes to get it done.
I think the lesson to be learned is that in our community there are
barriers
Quoted 12 lines
Quoted 2 lines
to the entry of substandard products and therefore people have to do their best if they really want to see their work applied.
Yes, you are right. Due to this reason, the whole process is making me learn a lot. I am really glad to be a part of it ^-^
Quoted 3 lines
These tasks are not for the "faints of heart" :-)
Fabio
Regards,
Khadija :)